Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: LayoutTests/fast/dom/compare-document-position-disconnected-nodes.html

Issue 20042003: compareDocumentPosition() should report PRECEEDING or FOLLOWING information even if nodes are disco… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add failing test to TestExpectations Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../js/resources/js-test-pre.js"></script> 4 <script src="../js/resources/js-test-pre.js"></script>
5 <script> 5 <script>
6 window.a = document.createElement('a'); 6 var a;
7 window.b = document.createElement('b'); 7 var b;
8 8
9 shouldBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_DISCONNE CTED', 'Node.DOCUMENT_POSITION_DISCONNECTED'); 9 function testElements(_a, _b) {
10 shouldBe('b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_DISCONNE CTED', 'Node.DOCUMENT_POSITION_DISCONNECTED'); 10 a = _a;
11 shouldBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_IMPLEMEN TATION_SPECIFIC', 'Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC'); 11 b = _b;
12 shouldBe('b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_IMPLEMEN TATION_SPECIFIC', 'Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC'); 12
13 shouldNotBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_PRECE DING', 'b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING'); 13 shouldBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_DISC ONNECTED', 'Node.DOCUMENT_POSITION_DISCONNECTED');
14 shouldNotBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLO WING', 'b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_FOLLOWING'); 14 shouldBe('b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_DISC ONNECTED', 'Node.DOCUMENT_POSITION_DISCONNECTED');
15 shouldBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_IMPL EMENTATION_SPECIFIC', 'Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC');
16 shouldBe('b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_IMPL EMENTATION_SPECIFIC', 'Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC');
17 shouldNotBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_P RECEDING', 'b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING');
18 shouldNotBe('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_F OLLOWING', 'b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_FOLLOWING');
19 shouldBeNonZero('a.compareDocumentPosition(b) & Node.DOCUMENT_POSITI ON_PRECEDING || a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING' );
20 shouldBeNonZero('b.compareDocumentPosition(a) & Node.DOCUMENT_POSITI ON_PRECEDING || b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_FOLLOWING' );
21 // Make sure the returned result is consistent.
22 shouldBe('a.compareDocumentPosition(b)', 'a.compareDocumentPosition( b)');
23 shouldBe('b.compareDocumentPosition(a)', 'b.compareDocumentPosition( a)');
24 }
25
26 debug("* Test with 2 disconnected elements");
27 testElements(document.createElement('a'), document.createElement('b'));
28 debug("* Test with document and a disconnected element");
29 testElements(document, document.createElement('b'));
30 debug("* Test with document and a disconnected attribute");
31 testElements(document, document.createAttribute('b'));
32 debug("* Test with 2 disconnected attributes");
33 testElements(document.createAttribute("a"), document.createAttribute("b" ));
34 debug("* Test with disconnected attribute and element");
35 testElements(document.createAttribute("a"), document.createElement("b")) ;
15 </script> 36 </script>
16 <script src="../js/resources/js-test-post.js"></script> 37 <script src="../js/resources/js-test-post.js"></script>
17 </head> 38 </head>
18 <body> 39 <body>
19 <p>Comparing the positions of two disconnected nodes should result in DOCUME NT_POSITION_DISCONNECTED.</p> 40 <p>Comparing the positions of two disconnected nodes should result in DOCUME NT_POSITION_DISCONNECTED.</p>
20 </body> 41 </body>
21 </html> 42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698