All Projects → keithclark → Css Feature Toggle Devtools Extension

keithclark / Css Feature Toggle Devtools Extension

Licence: mit
A devtools extension for toggling CSS features allowing developers to see how pages/apps render in browsers that don't support modern CSS features

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Css Feature Toggle Devtools Extension

Downthemall
The DownThemAll! WebExtension
Stars: ✭ 512 (+271.01%)
Mutual labels:  webextensions
Multipletab
Multiple Tab Handler, Provides feature to close multiple tabs.
Stars: ✭ 67 (-51.45%)
Mutual labels:  webextensions
Redux Webext
Redux for WebExtensions
Stars: ✭ 101 (-26.81%)
Mutual labels:  webextensions
Scrollupfolder
A firefox addon wich goes up a folder of a website.
Stars: ✭ 18 (-86.96%)
Mutual labels:  webextensions
Tabs Aside
A session/tab manager web extension for Firefox based on the Microsoft Edge feature.
Stars: ✭ 58 (-57.97%)
Mutual labels:  webextensions
Github Contribution Color Graph
Change colors of contribution graph in GitHub.
Stars: ✭ 70 (-49.28%)
Mutual labels:  webextensions
Read Aloud
An awesome browser extension that reads aloud webpage content with one click
Stars: ✭ 444 (+221.74%)
Mutual labels:  webextensions
Vertical Tabs Reloaded
Firefox add-on for arranging tabs vertically
Stars: ✭ 115 (-16.67%)
Mutual labels:  webextensions
Persian Twitter
A WebExtension which improves Twitter & TweetDeck user experience for Persian users
Stars: ✭ 66 (-52.17%)
Mutual labels:  webextensions
Retrotxt
RetroTxt is the WebExtension that turns ANSI, ASCII, NFO text into in-browser HTML
Stars: ✭ 93 (-32.61%)
Mutual labels:  webextensions
Jsdemos
Home page for all listed extensions, if you have any suggestions/bugs, please file an issue in this repo
Stars: ✭ 14 (-89.86%)
Mutual labels:  webextensions
Mue
Fast, open and free-to-use new tab page for modern browsers
Stars: ✭ 56 (-59.42%)
Mutual labels:  webextensions
Trace.moe Webextension
WebExtension for the Anime Reverse Search Engine to search by image
Stars: ✭ 89 (-35.51%)
Mutual labels:  webextensions
News Feed Eradicator
A browser extension that deletes your news feed and replaces it with a nice quote
Stars: ✭ 690 (+400%)
Mutual labels:  webextensions
Ui Tool
UI for create-web-ext
Stars: ✭ 104 (-24.64%)
Mutual labels:  webextensions
Proven
🔑✅ An alternative to Twitter's verified accounts powered by Keybase.
Stars: ✭ 511 (+270.29%)
Mutual labels:  webextensions
Passwords Webextension
The official browser extension for the Passwords app for Nextcloud.
Stars: ✭ 68 (-50.72%)
Mutual labels:  webextensions
Web Ext
A command line tool to help build, run, and test web extensions
Stars: ✭ 1,846 (+1237.68%)
Mutual labels:  webextensions
Page Translator
One-click in-line page translation for Firefox
Stars: ✭ 114 (-17.39%)
Mutual labels:  webextensions
Netflix Categories
Unlock Netflix Hidden Categories With This Browser Extension
Stars: ✭ 93 (-32.61%)
Mutual labels:  webextensions

CSS Feature Toggle Extension

This devtools extension provides the ability to toggle-off CSS features, allowing developers to see how their pages and applications render and fallback in browsers that don't support modern CSS features.

Available for Chrome via the Chrome Web Store.

Screengrab of the CSS Feature Toggle extension

Supported browsers

This extension uses devtools API features that aren't supported in Firefox yet:

  • devtools.inspectedWindow.getResources()
  • devtools.inspectedWindow.onResourceAdded
  • resource.getContent()
  • resource.setContent()

Limitations

Toggling CSS features isn't supported everywhere yet so you should be aware of these caveats:

  • Inline styles (<div style="...">) will not be disabled.
  • Changes made to a stylesheet via the CSSOM will not be disabled.

Contributing

Installing for development

  1. Clone this repo.
  2. Start Chrome, open the Extensions manager and enable Developer Mode.
  3. Click Load unpacked extension and select the repo folder (the one containing manifest.json)
  4. Open devtools and click the CSS Features tab to use the extension.

Making code changes

  1. Update code
  2. Close/re-open devtools to see your changes

Testing

In the /tests/browser directory you'll find a test page which can be opened in a supported browser. The page contains one or more tests for each toggle. If you make changes and want to submit a pull request, please ensure the tests behave first. If you're adding a new toggle, please try to update the page with relevant tests or ask for assistance in your pull request.


How it works

The extension uses browser.devtools.inpectedWindow.getResources() to fetch the content of stylesheet and document resources loaded in the current window. For stylesheet resources, resource.getContent() is used to extract the style content. For document resources, a script is injected into the document which extracts the CSS content from <style> elements.

Extracted style content is passed through a series of regular expressions that rename the feature property/value/identifiers. The original content is then replaced with the modified CSS using either resource.setContent, for stylesheets or - for document styles - by injecteding a script to update the relevant <style> elements. For example:

  • display: flex becomes display: -disabled-flex
  • @supports (...) {} becomes @-disabled-supports (...) {}
  • transform: ... becomes @-disabled-transform: ... {}
  • width: calc(...) becomes width: -disabled-calc(...)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].