Closed Bug 373536 Opened 17 years ago Closed 17 years ago

Binding doesn't get applied when dynamically adding display:none div during page load

Categories

(Core :: XML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: martijn.martijn, Unassigned)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

718 bytes, application/xhtml+xml
Details
Attached file testcase
See testcase, you should get an alert with the testcase, but that doesn't happen with current trunk builds.
This regressed between 2007-01-30 and 2007-01-31:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2007-01-30+04&maxdate=2007-01-31+06&cvsroot=%2Fcvsroot
I think this is a regression from bug 18333.
See also bug 372323.
Flags: blocking1.9?
Assigning to bz in case that bug fixes it. We can reassign otherwise.
Assignee: xml → bzbarsky
Flags: blocking1.9? → blocking1.9+
> bz, would the patch in bug 372323 fix this?

It doesn't.
So the fact that this ever worked was basically an accident, imo.  I don't see why in this situation the binding should be attached.

Note that if the _parent_ of the div were the thing that had display:none, then the binding wouldn't get attached even before the incremental XML changes.  The reason it's not getting attached now is the display:none check in nsCSSFrameConstructor::MaybeRecreateFramesForContent (which means we don't try to reconstruct the frame for the <div> when the sheet finishes loading and we restyle), and I think that's the right behavior, frankly.

It "worked" before because all the frame construction happened after the end of the document load.  It might start working again if we change when we do StartLayout to wait for the <head> to finish... or might not, depending on event timings.
Assignee: bzbarsky → xml
We should at least be consistent IMHO. If you add the element during onload instead when the stylesheet is loaded you do get the binding attached.
> We should at least be consistent IMHO.

We've never been consistent with XBL binding attachment, thanks to the hack in PostCreate that attaches bindings.  As a result of that hack, whether a binding gets attached depends on the relative timing of JS access and stylesheet loads.  That's all you're seeing here.

Note that holding off StartLayout() for <head> does happen to fix this particular testcase, though...  And we'll get that done for 1.9.
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
On second thought, we're not going to block on this.
Flags: blocking1.9+ → blocking1.9-
I do get an alert with the testcase, does this mean it's fixed?

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a9pre) Gecko/2007110705 Minefield/3.0a9pre ID:2007110705
Yeah, it was fixed somehow. Marking worksforme.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
It was fixed because we don't start layout now until we see <head>.  See comment 7.

If someone cares, the can dig in the nsXMLContentSink.cpp log for the relevant bug number.
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: