https://github.com/bpasero/style-observer-playground.git
This playground demonstrates an issue with Firefox where MutationObserver cannot observe changes to HTMLStyleSheet objects using { childList: true } options.
In Firefox, attempting to create a MutationObserver on a HTMLStyleSheet object and observe changes to its content (CSS rules) using { childList: true } does not work as expected. The observer does not fire when CSS rules are added, removed, or modified through the CSS Object Model (CSSOM) APIs.
index.html - Main test page with comprehensive UImutation-observer-test.js - Test implementation with multiple scenariosminimal-test.html - Simplified version for bug reportsREADME.md - This fileindex.html in FirefoxThe playground tests multiple ways of modifying stylesheets:
mutation.type should be 'childList' for rule additions/removalsaddedNodes/removedNodes should contain information about changed rules<style> element itselfSummary: MutationObserver with { childList: true } does not observe HTMLStyleSheet changes in Firefox
Steps to Reproduce:
<style> element in HTMLsheet property (HTMLStyleSheet){ childList: true } on the stylesheetinsertRule() or deleteRule() to modify the stylesheetActual Result: MutationObserver does not fire for CSSOM changes
According to the DOM specification, StyleSheet objects should be observable by MutationObserver when their child rules change, as CSS rules are considered child nodes of the stylesheet in the CSSOM.