Closed Bug 1502875 Opened 2 years ago Closed 2 years ago

Remove XULDocument::AddSubtreeToDocumentPre.

Categories

(Core :: XUL, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(4 files)

BindToTree takes care of adding to the ID table.
The ID table is managed in BindToTree / UnbindFromTree.

I guess this was more important when XUL templates were a thing.
Not sure if it's related to this, but we've been finding and removing cases where we were relying on `document.getElementById("foo")` traversing into XBL anon content (bug 1502151, bug 1500240), since that doesn't work in HTML documents. As far as I know there aren't any more places where we do that, and if there are we can remove them.
Depends on: 1425356
(In reply to Brian Grinstead [:bgrins] from comment #3)
> Not sure if it's related to this, but we've been finding and removing cases
> where we were relying on `document.getElementById("foo")` traversing into
> XBL anon content (bug 1502151, bug 1500240), since that doesn't work in HTML
> documents. As far as I know there aren't any more places where we do that,
> and if there are we can remove them.

Oh, that's awesome.
Priority: -- → P3
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
> Created attachment 9020811 [details]
> Bug 1502875 - Don't let GetElementById work across anonymous subtree
> boundaries in XUL documents. r=smaug
> 
> According to comment 3 the front-end no longer needs it.

Richard, if TB is relying on document.getElementById traversing into XBL content, behavior can be restored by using something like `document.getAnonymousElementByAttribute(xblHostElement, "id", id)` (see bug 1502151 and bug 1500240).
Flags: needinfo?(richard.marti)
This is needed to make the "Simplify AddToIdTable" patch work. I'll
land it before that one.
(In reply to Brian Grinstead [:bgrins] from comment #6)
> (In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
> > Created attachment 9020811 [details]
> > Bug 1502875 - Don't let GetElementById work across anonymous subtree
> > boundaries in XUL documents. r=smaug
> > 
> > According to comment 3 the front-end no longer needs it.
> 
> Richard, if TB is relying on document.getElementById traversing into XBL
> content, behavior can be restored by using something like
> `document.getAnonymousElementByAttribute(xblHostElement, "id", id)` (see bug
> 1502151 and bug 1500240).

Thank you for the heads-up, Brian. I'll n-i other c-c people which know this a lot better than me.
Flags: needinfo?(richard.marti)
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(jorgk)
Flags: needinfo?(acelists)
Thank you. We know that you need to use getAnonymousElementByAttribute() to get an anonymous element so if there is use of getElementById instead, it should be by mistake and we will fix it.

I'll do some test run asserting when there is an ID and IsInAnonymousSubtree().
Flags: needinfo?(acelists)
Depends on: 1502997
I have created bug 1502997 for the cases found in Thunderbird.
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(jorgk)
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4fb88c6c2223
Remove AddElementToDocumentPre and RemoveSubtreeFromDocument. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/7a38544a9172
Don't call AddToIdTable when moving around a shadow root. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/8157760bbde1
Simplify AddIdElement. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/b7a966ea9ad3
Don't let GetElementById work across anonymous subtree boundaries in XUL documents. r=smaug
You need to log in before you can comment on or make changes to this bug.