andyedinborough / stress-css

JavaScript to test each CSS class on a page and report which are hindering performance
869 stars 40 forks source link

Don’t just test classes #1

Closed mathiasbynens closed 13 years ago

mathiasbynens commented 13 years ago

It would be great if the bookmarklet could test elements with IDs as well. Ultimately it would just test every CSS selector in use, including those that don’t use IDs or classnames, but I can see how that would complicate things.

andyedinborough commented 13 years ago

Yeah, I had that thought as well. ID's wouldn't be hard, but all selectors would be pain. I had the thought that I could use AJAX to grab text versions of all the page CSS, parse the selectors, but then I wasn't sure how I could disable a specific selector.

andyedinborough commented 13 years ago

I just released the ability to test ID's.

To test all selectors, I think I'll have to parse the CSS completely, find the elements that match the selector, and try to set each property specified by the rule, to the default--I don't think you can simply remove a property.