OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script src="resources/shadow-dom.js"></script> | 5 <script src="resources/shadow-dom.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div id="sandbox"></div> | 8 <div id="sandbox"></div> |
9 <script> | 9 <script> |
10 description("Tests for node's contains()."); | 10 description("Tests for node's contains()."); |
11 | 11 |
12 document.getElementById('sandbox').appendChild( | 12 document.getElementById('sandbox').appendChild( |
13 createDOM('div', {'id': 'shadowHostA'}, | 13 createDOM('div', {'id': 'shadowHostA'}, |
14 createShadowRoot( | 14 createShadowRoot( |
15 createDOM('div', {'id': 'divA'}), | 15 createDOM('div', {'id': 'divA'}), |
16 createDOM('div', {'id': 'shadowHostB'}, | 16 createDOM('div', {'id': 'shadowHostB'}, |
17 createShadowRoot( | 17 createShadowRoot( |
18 createDOM('div', {'id': 'divB'}))), | 18 createDOM('div', {'id': 'divB'}))), |
19 createDOM('div', {'id': 'shadowHostC'}, | 19 createDOM('div', {'id': 'shadowHostC'}, |
20 createShadowRoot( | 20 createShadowRoot( |
21 createDOM('div', {'id': 'divC'})))))); | 21 createDOM('div', {'id': 'divC'})))))); |
22 | 22 |
23 | 23 |
24 // Comparing a document with a node in a shadow tree. | 24 // Comparing a document with a node in a shadow tree. |
25 shouldBeTrue('document.contains(getNodeInTreeOfTrees("shadowHostA/"))'); | 25 shouldBeFalse('document.contains(getNodeInTreeOfTrees("shadowHostA/"))'); |
26 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/").contains(document)'); | 26 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/").contains(document)'); |
27 shouldBeTrue('document.contains(getNodeInTreeOfTrees("shadowHostA/divA"))'); | 27 shouldBeFalse('document.contains(getNodeInTreeOfTrees("shadowHostA/divA"))'); |
28 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(document)'); | 28 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(document)'); |
29 | 29 |
30 // Comparing a node in document with a node in a shadow tree. | 30 // Comparing a node in document with a node in a shadow tree. |
31 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/").contains(getNodeInTreeOfTrees
("shadowHostA/divA"))'); | 31 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/").contains(getNodeInTreeOfTrees
("shadowHostA/divA"))'); |
32 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(getNodeInTreeOf
Trees("shadowHostA/"))'); | 32 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(getNodeInTreeOf
Trees("shadowHostA/"))'); |
33 | 33 |
34 // Comparing a node in a shadow tree with a node in a shadow tree enclosing the
first tree. | 34 // Comparing a node in a shadow tree with a node in a shadow tree enclosing the
first tree. |
35 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/").contains(getNodeInTreeOfTrees
("shadowHostA/shadowHostB/"))'); | 35 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/").contains(getNodeInTreeOfTree
s("shadowHostA/shadowHostB/"))'); |
36 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNode
InTreeOfTrees("shadowHostA/"))'); | 36 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNode
InTreeOfTrees("shadowHostA/"))'); |
37 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(getNodeInTreeOf
Trees("shadowHostA/shadowHostB/divB"))'); | 37 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/divA").contains(getNodeInTreeOf
Trees("shadowHostA/shadowHostB/divB"))'); |
38 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/divB").contains(get
NodeInTreeOfTrees("shadowHostA/divA"))'); | 38 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/divB").contains(get
NodeInTreeOfTrees("shadowHostA/divA"))'); |
39 | 39 |
40 // Comparing a node in a shadow tree with a node in a sibling shadow tree. | 40 // Comparing a node in a shadow tree with a node in a sibling shadow tree. |
41 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNode
InTreeOfTrees("shadowHostA/shadowHostC/"))'); | 41 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNode
InTreeOfTrees("shadowHostA/shadowHostC/"))'); |
42 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostC/").contains(getNode
InTreeOfTrees("shadowHostA/shadowHostB/"))'); | 42 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostC/").contains(getNode
InTreeOfTrees("shadowHostA/shadowHostB/"))'); |
43 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/divB").contains(get
NodeInTreeOfTrees("shadowHostA/shadowHostC/divC"))'); | 43 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostB/divB").contains(get
NodeInTreeOfTrees("shadowHostA/shadowHostC/divC"))'); |
44 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostC/divC").contains(get
NodeInTreeOfTrees("shadowHostA/shadowHostB/divB"))'); | 44 shouldBeFalse('getNodeInTreeOfTrees("shadowHostA/shadowHostC/divC").contains(get
NodeInTreeOfTrees("shadowHostA/shadowHostB/divB"))'); |
45 | 45 |
46 // Self-comparing a node in a shadow tree. | 46 // Self-comparing a node in a shadow tree. |
47 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/shadowHostB").contains(getNodeIn
TreeOfTrees("shadowHostA/shadowHostB"))'); | 47 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/shadowHostB").contains(getNodeIn
TreeOfTrees("shadowHostA/shadowHostB"))'); |
48 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNodeI
nTreeOfTrees("shadowHostA/shadowHostB/"))'); | 48 shouldBeTrue('getNodeInTreeOfTrees("shadowHostA/shadowHostB/").contains(getNodeI
nTreeOfTrees("shadowHostA/shadowHostB/"))'); |
49 </script> | 49 </script> |
50 </body> | 50 </body> |
OLD | NEW |