Closed
Bug 378087
Opened 17 years ago
Closed 17 years ago
document.getAnonymousNodes(this) returned null when the binding is in a custom namespace
Categories
(Core :: XBL, defect)
Core
XBL
Tracking
()
RESOLVED
INVALID
People
(Reporter: henry.li, Unassigned)
Details
Attachments
(3 files, 2 obsolete files)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; (R1 1.5); .NET CLR 2.0.50727) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 If the binding is declared in a custom namespace, the method document.getAnonymousNodes(this) returns null. This forces one to use the xul or html namespace only for xbl defined components. Reproducible: Always Steps to Reproduce: 1. Create a binding using xbl in which make use of the function document.getAnonymousNodes(this) (e.g., in the constructor, add a line to alert the result to make sure that it is not null). 2. Create a stylesheet (name it mytag.css) to define bind a tag to the binding like the following @namespace myns url(http://my.namespace.com/custom); myns|mytag { -moz-binding: url('mytag.xml#mytag'); } 3. Use the custom tag in a page like the below: <?xml version="1.0"?> <?xml-stylesheet href="mytag.css" type="text/css"?> <xul:window xmlns:myns="http://my.namespace.com/custom" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <mytag> </mytag> </xul:window> 4. Try access the newly created xul page. Actual Results: The alert for the result of document.getAnonymousNodes(this) returns null. Expected Results: returns the children of the <content> tag in an array Would a fuction like document.getAnonymousNodesNS(aNamespaceURL, this) help in solving this?
Step 3 above should look like this: <?xml version="1.0"?> <?xml-stylesheet href="mytag.css" type="text/css"?> <xul:window xmlns:myns="http://my.namespace.com/custom" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <myns:mytag> </myns:mytag> </xul:window>
Comment 2•17 years ago
|
||
Could you please upload a testcase using "Add an attachment"
Comment 3•17 years ago
|
||
Yeah, please do upload a testcase. This should work.
This is the xbl file I'm working on. It is a working component - composed of a left list a right list box and a couple of move buttons in the middle. The buttons are used to move items between the left and right list boxes. I added an alert in the getter method for the twinboxes property to check for null. The css file and a test.xul file will be uploaded next.
Comment 7•17 years ago
|
||
Comment 8•17 years ago
|
||
Attachment #264577 -
Attachment is obsolete: true
Attachment #264578 -
Attachment is obsolete: true
Comment 9•17 years ago
|
||
I see. Your bound element has child nodes with no insertion points in the binding (the text node children, to be precise). When this happens, XBL doesn't install anonymous content. This is documented at http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference:Anonymous_Content#Rules_for_Generation paragraph, 3, for example. Generally, one adds a catch-all insertion point inside a display:none parent to prevent this from being a problem. This doesn't happen with XUL because the XUL content sink strips out whitespace-only text children of all XUL nodes other than <xul:label> and <xul:description>.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•