|
1 <?xml version="1.0"?> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=419527 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 419527</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 <bindings xmlns="http://www.mozilla.org/xbl" |
|
11 xmlns:html="http://www.w3.org/1999/xhtml"> |
|
12 <binding id="rangebinding"> |
|
13 <content><html:span>Foo</html:span> |
|
14 </content> |
|
15 <implementation> |
|
16 <constructor> |
|
17 var win = XPCNativeWrapper.unwrap(window); |
|
18 var span = document.getAnonymousNodes(this)[0]; |
|
19 win.ok(span.localName == "span", "Wrong anon node!"); |
|
20 var range = document.createRange(); |
|
21 range.selectNode(span.firstChild); |
|
22 win.ok(range.startContainer == span, "Wrong start container!"); |
|
23 win.ok(range.endContainer == span, "Wrong end container!"); |
|
24 var newSubTree = XPCNativeWrapper(win.newSubTree); |
|
25 newSubTree.appendChild(this); |
|
26 range.setStart(newSubTree.firstChild, 0); |
|
27 win.ok(range.startContainer == newSubTree.firstChild, |
|
28 "Range should have been collapsed to newSubTree.firstChild!"); |
|
29 win.ok(range.endContainer == newSubTree.firstChild, |
|
30 "Range should have been collapsed to newSubTree.firstChild!"); |
|
31 //XXX This should just call SimpleTest.finish(), bugs 478528, 499735. |
|
32 setTimeout(win.finish, 0); |
|
33 </constructor> |
|
34 </implementation> |
|
35 </binding> |
|
36 </bindings> |
|
37 </head> |
|
38 <body> |
|
39 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=419527">Mozilla Bug 419527</a> |
|
40 <p id="display"></p> |
|
41 <div id="content" style="display: none"> |
|
42 |
|
43 </div> |
|
44 <pre id="test"> |
|
45 <script class="testbody" type="text/javascript"> |
|
46 <![CDATA[ |
|
47 |
|
48 /** Test for Bug 419527 **/ |
|
49 |
|
50 var d; |
|
51 |
|
52 function runRangeTest() { |
|
53 window.newSubTree = document.createElementNS("http://www.w3.org/1999/xhtml", "div"); |
|
54 newSubTree.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "div")); |
|
55 |
|
56 d = document.createElementNS("http://www.w3.org/1999/xhtml", "div"); |
|
57 d.style.MozBinding = "url('" + window.location + "#rangebinding" + "')"; |
|
58 document.body.appendChild(d); |
|
59 } |
|
60 |
|
61 function finish() { |
|
62 SimpleTest.finish(); |
|
63 } |
|
64 |
|
65 SimpleTest.waitForExplicitFinish(); |
|
66 setTimeout(runRangeTest, 0); |
|
67 |
|
68 |
|
69 ]]> |
|
70 </script> |
|
71 </pre> |
|
72 </body> |
|
73 </html> |
|
74 |