|
1 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
2 <!-- |
|
3 https://bugzilla.mozilla.org/show_bug.cgi?id=330925 |
|
4 --> |
|
5 <head> |
|
6 <title>Test for Bug 330925</title> |
|
7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
9 |
|
10 <style type="text/css"> |
|
11 #t { |
|
12 -moz-binding: url(#randomxbl); |
|
13 } |
|
14 </style> |
|
15 |
|
16 <bindings xmlns="http://www.mozilla.org/xbl"> |
|
17 <binding id="randomxbl" inheritstyle="false"> |
|
18 <content> |
|
19 xbl textnode1 |
|
20 <div> |
|
21 xbl textnode2 |
|
22 <children xmlns="http://www.mozilla.org/xbl"/> |
|
23 </div> |
|
24 </content> |
|
25 </binding> |
|
26 </bindings> |
|
27 |
|
28 </head> |
|
29 <body> |
|
30 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330925">Mozilla Bug 330925</a> |
|
31 |
|
32 <p id="display"> |
|
33 <div id="t" /> |
|
34 </p> |
|
35 |
|
36 <pre id="test"> |
|
37 <script class="testbody" type="text/javascript"> |
|
38 <![CDATA[ |
|
39 |
|
40 /** Test for Bug 330925 **/ |
|
41 |
|
42 // We have to wait until onload because XBL doesn't bind immediately. |
|
43 SimpleTest.waitForExplicitFinish(); |
|
44 addLoadEvent(init); |
|
45 |
|
46 function init() |
|
47 { |
|
48 var t = document.getElementById("t"); |
|
49 var d = SpecialPowers.wrap(document); |
|
50 |
|
51 is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[0])), |
|
52 t, |
|
53 "Wrong binding parent for anonymous node"); |
|
54 |
|
55 is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[1].childNodes[0])), |
|
56 t, |
|
57 "Wrong binding parent for child of anonymous node"); |
|
58 |
|
59 is(d.getBindingParent(t), |
|
60 null, |
|
61 "Non-anonymous node should not have a binding parent"); |
|
62 |
|
63 is(d.getBindingParent(document.documentElement), |
|
64 null, |
|
65 "Document element should not have a binding parent"); |
|
66 |
|
67 SimpleTest.finish(); |
|
68 } |
|
69 |
|
70 ]]> |
|
71 </script> |
|
72 </pre> |
|
73 </body> |
|
74 </html> |