4 ms·
Cool. I'm curious - how'd you do it? Is there any open source library to find out CSS rules?
by dm8 13y ago
Cool. I'm curious - how'd you do it? Is there any open source library to find out CSS rules?
- yuchi 13y agoYou can use cssom (by visionmedia) and document.querySelectorAll/sizzle.
- hacker789 13y agoPresumably, you could take the selectors in the CSS and pass them to a JavaScript selector engine. That way, you'd automatically have a list of elements affected by each rule.
- benjaminbenben 13y agodocument.stylesheets - https://developer.mozilla.org/en-US/docs/Web/API/document.styleSheets https://developer.mozilla.org/en-US/docs/Web/API/document.st... The main part of the injected code is https://gist.github.com/benfoxall/5647039 https://gist.github.com/benfoxall/5647039 - there's a bit of hacking round cors issues there too.