Moving node with binding between documents is broken

NEW
Unassigned

Status

()

14 years ago
9 years ago

People

(Reporter: surkov, Unassigned)

Tracking

(Depends on: 2 bugs, Blocks: 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(5 attachments, 3 obsolete attachments)

(Reporter)

Description

14 years ago
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
(Reporter)

Comment 1

14 years ago
Created attachment 169694 [details]
bindings
(Reporter)

Comment 2

14 years ago
Created attachment 169695 [details]
-moz-binding
(Reporter)

Comment 3

14 years ago
Created attachment 169696 [details]
second document
(Reporter)

Comment 4

14 years ago
Created attachment 169697 [details]
first document (run it)

Make package and run firstdoc.xul file. Content of attached node into second
document has not bindings. See by DOM Inspector.
(Reporter)

Comment 5

14 years ago
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.
Created attachment 172479 [details]
CSS pointing to bindings
Attachment #169695 - Attachment is obsolete: true
Created attachment 172480 [details]
Second document modified to not need openDialog
Attachment #169696 - Attachment is obsolete: true
Created attachment 172481 [details]
Ignore this one.
Attachment #169697 - Attachment is obsolete: true
Created attachment 172483 [details]
First document, modified to point to second. LOAD THIS.
Attachment #172481 - 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
QA Contact: ian → xbl

Updated

9 years ago
Assignee: hyatt → nobody
You need to log in before you can comment on or make changes to this bug.