Closed Bug 276190 Opened 20 years ago Closed 5 years ago

Moving node with binding between documents is broken

Categories

(Core :: XBL, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: surkov, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(5 files, 3 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041122 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041122 I create node with binding in first document, clone it and attach into second document. I dont include styles into second document where -moz-binding is defined. In this case binding has all properties and methods, has content, but bindings for content is not defined. Reproducible: Always Steps to Reproduce: //bindings.xml <bindings id="testBindings" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <binding id="binding1"> <content> <xul:textbox/> </content> </binding> </bindings> //bindings.css binding1{ -moz-binding: url('bindings.xml#binding1'); } //firstdoc.xul <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <binding1 id="bnd"/> <script> var node=document.getElementById('bnd'); openDialog('seconddoc.xul', 'helo', '', node); </script> </window> //seconddoc.xul <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> var node=window.arguments[0]; var newnode=node.clone(node); document.getElementById('container').appendChild(newnode); </script> <box id="container"/> </window> Actual Results: textbox of binding content has not bindings Expected Results: textbox of binding shuld have bindings
Attached file bindings
Attached file -moz-binding (obsolete) —
Attached file second document (obsolete) —
Attached file first document (run it) (obsolete) —
Make package and run firstdoc.xul file. Content of attached node into second document has not bindings. See by DOM Inspector.
If I don't clone the node and I attach it to second document then I get the next situation. If I don't include styles with -moz-binding into second document then node isn't displayed. If I include thease styles then I node is displayed.
Attachment #169695 - Attachment is obsolete: true
Attached file Ignore this one.
Attachment #169697 - Attachment is obsolete: true
Attachment #172481 - Attachment description: First document, modified to point to second. LOAD THIS. → Ignore this one.
Attachment #172481 - Attachment is obsolete: false
So the problem here is that when we clone the node we attach a binding to it based on its ownerDocument. Then when we insert the node into our new document, we call nsBindingManager::ChangeDocumentFor on the node. This sets the same binding in the binding manager of the new document (why?) and messes around with the anonymous content; specifically it sets the document on all the anonymous content to null. As a result, styles don't apply to it (it's not in a document), so we don't apply xul.css, hence no rendering. So what is ChangeDocumentFor really trying to accomplish? If it's trying to kill off the binding, why is it transferring it to the new document? If it's trying to keep the binding alive, why is it setting the document on all anonymous content to null?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Summary: node with binding isn't displayed → Moving node with binding between documents is broken
Depends on: 284707
Blocks: 229703
Depends on: 289317
QA Contact: ian → xbl
Assignee: hyatt → nobody

XBL is now disabled in Firefox (Bug 1583314) and is in the process of being removed from Gecko (Bug 1566221), so closing bugs requesting changes to its implementation as wontfix.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: