Style mutation observer

Hey all,

I’ve been holding off on bringing this up because I don’t have a specific 
suggestion, but I figure we should start talking about how to design 
something like a style mutation observer.



CSS polyfills need to be able to respond to things like:

1. Property value changes for a selector

The immediate need is for computed values. Parsing code would also need 
declared values, but that might be better exposed for rules rather than 
selectors. There should probably be a way to filter for particular 
properties. Polyfills need to run code based on the values of their new 
properties, and possibly on existing property values (like display:none) 
that interact with the new properties.

2. Changes to qSA results for a selector

This might not be strictly necessary, but it would reduce qSA calls. 
Returning a list of added and removed items in the results could reduce 
polyfill record-keeping. Polyfills need to run code for new matches, and 
clean up code on removals.

3. Added/Removed selectors

If style rules change, polyfills need to scan new selectors to see if they 
include relevant declarations, and run clean up code on removed rules.

Please comment on where I’m wrong and what I’ve missed.

Thanks,

Alan

Received on Monday, 19 January 2015 22:08:13 UTC