Open Bug 1105027 Opened 10 years ago Updated 2 years ago

Element.createShadowTree does not update style sheets in the old ShadowRoot

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

People

(Reporter: heycam, Unassigned)

Details

Attachments

(1 file)

Attached file test
Consider the attached test.  It should display "1 0 1", according to bug 1098270 comment 19.  I think we try to make the second number "0", by unbinding the contents of a ShadowRoot when we create a new, younger ShadowRoot for the host element, but we don't end up calling UpdateStyleSheet on <style> elements we unbind.
In Element::CreateShadowRoot, we first set the newly ShadowRoot on the host element, and then we call UnbindFromTree on the children of the older ShadowRoot.  In HTMLStyleElement::UnbindFromTree, GetComposedDoc() returns null (because the <style> element now indeed isn't in the composed document) and we exit early without calling UpdateStyleSheetInternal.

I wonder if we can just remove that check and early exit in HTMLStyleElement::UnbindFromTree.
(In reply to Cameron McCormack (:heycam) from comment #1)
> I wonder if we can just remove that check and early exit in
> HTMLStyleElement::UnbindFromTree.

This plus the changes mentioned in bug 1098270 to use GetComposedDoc() in nsStyleLinkElement::DoUpdateStyleSheet seems to work.
Yes, the combination of those would make sense to me.  But again, it would be good to have a clear idea of what behavior the spec wants here....
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: