Closed
Bug 71191
Opened 24 years ago
Closed 20 years ago
can't have binding on outermost (root) element in xml document
Categories
(Core :: XBL, defect)
Core
XBL
Tracking
()
RESOLVED
FIXED
People
(Reporter: alex, Assigned: mrbkap)
References
Details
(Whiteboard: [xbl1.0])
Attachments
(4 files)
185 bytes,
text/xml
|
Details | |
260 bytes,
text/html
|
Details | |
7.87 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
7.26 KB,
patch
|
bzbarsky
:
review-
|
Details | Diff | Splinter Review |
This file fails to load: --------------------------------------------------- -- test.xml -- <?xml version="1.0" ?> <?xml-stylesheet href="test.css" type="text/css"?> <mydoctag/> --------------------------------------------------- -- test.css -- mydoctag{ background-color: red; -moz-binding: url(test-binding.xml#mydoctag); } --------------------------------------------------- -- test-binding.xml -- <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="mydoctag"> <handlers> <handler event="bindingattached"> dump("bindingattached fired!\n"); </handler> </handlers> </binding> </bindings> Neither is the background red, nor does the event handler fire. If the binding is removed, behaviour is as expected (i.e. background is red). If <mydoctag> is nested in some other tag, as in <doc><mydoctag/></doc> the event handler fires ok.
Comment 1•24 years ago
|
||
accepting. thanks.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → mozilla0.9.1
Updated•24 years ago
|
Whiteboard: [xbl1.0]
Comment 2•23 years ago
|
||
This isn't an XBL bug... the styles don't match. Maybe you need to specify a namespace in the XML file?
Target Milestone: mozilla0.9.1 → Future
Comment 3•20 years ago
|
||
(In reply to comment #2) > Maybe you need to specify a > namespace in the XML file? Perhaps I didn't understood, but even with a XML file with namespace we can't add a binding on the root element... (By the way, this is seen on linux also)
Comment 4•20 years ago
|
||
*** Bug 216263 has been marked as a duplicate of this bug. ***
Updated•20 years ago
|
Status: ASSIGNED → NEW
OS: Windows 2000 → All
QA Contact: jrgmorrison → ian
Hardware: PC → All
Summary: can't have binding on outermost element in xml document → can't have binding on outermost (root) element in xml document
Target Milestone: Future → ---
Comment 5•20 years ago
|
||
Source of xbl file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="test"> <content><children/> ***extra text caused by xbl binding***</content> </binding> </bindings>
Comment 6•20 years ago
|
||
Source of html file: <html><head> <style> html{background-color:green; -moz-binding:url(http://bugzilla.mozilla.org/attachment.cgi?id=156915&action=view#test);} </style> </head> <body> After this there should come "***extra text caused by xbl binding***" </body> </html> Currently you'll get to see a blank page, which isn't correct. This works when I use the body as css selector.
Comment 7•20 years ago
|
||
The root node is Special (for example, you can't change its display type either).... So I do believe the frame construction path for the root never looks for bindings.
For my patch in https://bugzilla.mozilla.org/show_bug.cgi?id=262166 I wanted to really add it to the top svg element (so the methods would be available in intrinsic events when there was no script element in the document, but this blocked it. Would be nice to have this functionality.
Assignee | ||
Comment 9•20 years ago
|
||
Taking (I'm working on a fix). Note to self: The top level canvas frame is always resized to the size of the viewport after layout (and after being SetRect()'d to its child's size) by its parent nsScrollBoxFrame (see nsScrollBoxFrame.cpp:369).
Assignee: hyatt → mrbkap
Assignee | ||
Comment 10•20 years ago
|
||
There were 3 seperate issues here: 1) nsCSSFrameConstructor::ConstructRootFrame() should not have been setting the document element's primary frame, as this was stopping asynchronous bindings from applying correctly. 2) nsCSSFrameConstructor::ContentInserted() needed to call AppendFrames() on the root containing block if the initial reflow had already happened and the root frame was being created due to, e.g., asycnrhonous XBL bindings. 3) CanvasFrame::Reflow() needed to invalidate its entire rect since the initial reflow was missing the new styles applied.
Assignee | ||
Updated•20 years ago
|
Attachment #171775 -
Flags: review?(bzbarsky)
Comment 11•20 years ago
|
||
Comment on attachment 171775 [details] [diff] [review] patch v1 r+sr=bzbarsky
Attachment #171775 -
Flags: superreview+
Attachment #171775 -
Flags: review?(bzbarsky)
Attachment #171775 -
Flags: review+
Assignee | ||
Comment 12•20 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 13•17 years ago
|
||
We should add this to a test suite. I accidentally regressed it a few days ago... We might need to get bug 379922 fixed first, though.
Flags: in-testsuite?
Comment 14•17 years ago
|
||
(In reply to comment #13) > We should add this to a test suite. I accidentally regressed it a few days > ago... Due to the patch for bug 377850, right? How did you determine that you regressed this bug? I can't seem to reproduce this bug with the patch in bug 377850 applied.
Comment 15•17 years ago
|
||
Odd. I could...
Comment 16•17 years ago
|
||
Looks like this is broken on current trunk.
Comment 17•17 years ago
|
||
Testcases for xhtml, xml, xul and svg. In xml and svg, mochi stuff is not styled, because the class selector is not recognized there. It seems to me that should just work, no?
Comment 18•17 years ago
|
||
(In reply to comment #16) > Looks like this is broken on current trunk. It seems to work just fine for me with today's trunk build. Do you have an non-working example?
Updated•17 years ago
|
Attachment #269156 -
Flags: review?(bzbarsky)
Comment 19•17 years ago
|
||
In my build, attachment 156917 [details] renders nothing at all. Could be something on my end, though...
Comment 20•17 years ago
|
||
Ah, you're right. I'm getting this error in the error console. Security Error: Content at https://bugzilla.mozilla.org/attachment.cgi?id=156917 may not load data from http://bugzilla.mozilla.org/attachment.cgi?id=156915&action=view#test. This was caused by bug 379959, which might be intentional.
Comment 21•17 years ago
|
||
Is it really intentional that the failure of the binding to load causes the content to disappear?
Comment 22•17 years ago
|
||
Afaik, that has always been the case. I'm not sure if it's intentional. I certainly don't like current behavior.
Comment 23•17 years ago
|
||
> In xml and svg, mochi stuff is not styled See bug 386526. > failure of the binding to load causes the content to disappear That's how XBL1 basically works right now -- frame construction is blocked on the binding load, and if the binding load fails for any reason the frames are not constructed, because we trigger the reconstruct off completion of the binding load. I don't know whether that's purposeful; you'd have to ask hyatt, I think.
Comment 24•17 years ago
|
||
Comment on attachment 269156 [details] [diff] [review] mochitestcases >Index: content/xbl/test/Makefile.in >Index: content/xbl/test/test_bug71191.svg >+ -moz-binding:url('#rd'); why "rd"? Perhaps "root" would be clearer? >+<body onload="doe()" xmlns="http://www.w3.org/1999/xhtml"> I'd prefer you didn't use an onload attribute here. Use addLoadEvent() in the script below instead. >+ ok(document.documentElement.bound, "Root element is xbl bound"); Hmm... It seems that the ok() function is very easy to misuse (as in this case). That call is missing the diagnostic message, or rather putting it in the "test name" field. It would make more sense here to do: is(document.documentElement.bound, true, "Root element is xbl bound"); To make sure this doesn't pass by accident because SVG adds a "bound" property, could you have the same test without the binding comparing document.documentElement.bound to false? >Index: content/xbl/test/test_bug71191.xhtml This has a very different structure from the SVG test; in particular it does not wait for onload. Why not? All the comments from the SVG test apply here. >Index: content/xbl/test/test_bug71191.xml It looks like this test will time out if it fails, no? Is there a reason for yet a third way to structure things like this? >Index: content/xbl/test/test_bug71191.xul Same comments as for SVG.
Attachment #269156 -
Flags: review?(bzbarsky) → review-
You need to log in
before you can comment on or make changes to this bug.
Description
•