Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to unship: DOMAttrModified and DOMSubtreeModified event for changes via CSSOM

93 views
Skip to first unread message

Xidorn Quan

unread,
May 22, 2018, 8:34:26 PM5/22/18
to dev-pl...@lists.mozilla.org
In bug 1460295[1], I intend to stop triggering DOMAttrModified event as well as the general event DOMSubtreeModified for changes on style attribute via CSSOM by default. This behavior will be controlled by a pref "dom.mutation-events.cssom.disabled" so that we can revert it if necessary.

Blink and WebKit don't support DOMAttrModified event at all, and thus there is no DOMSubtreeModified event fired for attribute value changes in general (but when an attribute is added or removed, they trigger DOMNodeInsertedIntoDocument and DOMNodeRemovedFromDocument which we don't support). Edge supports DOMAttrModified in the same way as us.

Triggering such event causes webcompat issue for us, because there are websites which listen on DOMSubtreeModified event, and change style of its descendants in the handler, which triggers nested DOMSubtreeModified event. It is particular severe for us because we may trigger the event even when an identical value is set to a property (because of changes to the order, per working group resolution for resolving some edge cases involving logical properties cascading[2]), and nested DOMSubtreeModified event can lock up the content process.

DOMAttrModified is a deprecated feature, and we may want to eventually remove it at some point. A telemetry was recently added in bug 1461696[3], and the data collected so far shows there are 0.34% pages visited are listening to that event, which is probably a non-trivial number for removing itself, but I wouldn't expect there are many pages in this 0.34% to want to track style attribute change from CSSOM.

DOMSubtreeModified may be used by more pages, but given Blink and WebKit doesn't fire it for attribute changes in general, I would also be surprised if websites rely on it being fired for changes from CSSOM.

Spec-wise, the timing of triggering these mutation events is pretty much under-specified. Given they are deprecated in the spec as well as in our console warning, it's probably not too bad in the perspective of conformance.

Given these, I think we would prefer not to trigger the DOM mutation events for changes on style attribute from CSSOM. There still exist some risks that it may break some sites. In that case, we might change the pref to revert this behavior.

Note that, there is no change to Mutation Observer. Observers would continue to get triggered for changes on style attribute from CSSOM (in a somehow buggy way, see bug 1197705[4]) if relevant.


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1460295
[2] https://github.com/w3c/csswg-drafts/issues/1898#issuecomment-342556321
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1461696
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1197705


- Xidorn
0 new messages