ausi / cq-prolyfill

Prolyfill for CSS Container Queries
https://au.si/css-container-element-queries
MIT License
567 stars 39 forks source link

Observing attribute (e.g. class) changes #22

Closed woble closed 8 years ago

woble commented 8 years ago

Is there a particular reason why attribute mutations (e.g. class being changed by frameworks like Aurelia or AngularJS) aren't obeserved by the script?

ausi commented 8 years ago

Attribute mutations may happen quite frequently and it is also common to change the class attribute of the <html> element. This would eventually cause performance issues, because all container queries on the page would have to be checked if <html> or <body> gets changed.

If you’re using a JavaScript framework, it may be possible to hook into the modifications without an MutationObserver and then call the prolyfill API. If this is not possible or doesn’t make sense in your use case you can create a MutationObserver yourself to trigger the changes.