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

Side by Side Diff: LayoutTests/fast/dom/Range/range-detached-exceptions.html

Issue 252783002: Make Range.detach() a no-op (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <!-- hidden area to create the ranges being tested -->
8 <div style="visibility: hidden">
9 <div id=a1>a1
10 <div id=b1>b1</div>
11 </div>
12 </div>
13
14 <script>
15 function execute(method) {
16 return '"InvalidStateError: Failed to execute \'' + method + '\' on \'Range\': The range has no container. Perhaps \'detach()\' has been invoked on this object?"';
17 }
18 function read(property) {
19 return '"InvalidStateError: Failed to read the \'' + property + '\' property from \'Range\': The range has no container. Perhaps \'detach()\' has be en invoked on this object?"';
20 }
21
22 description("A variety of Range methods should throw if called on a deta ched range.");
23 var range = document.createRange();
24 range.selectNode(document.getElementById("a1"));
25 range.detach();
26
27 shouldThrow("range.cloneContents()", execute("cloneContents"));
28 shouldThrow("range.cloneRange()", execute("cloneRange"));
29 shouldThrow("range.collapsed", read("collapsed"));
30 shouldThrow("range.commonAncestorContainer", read("commonAncestorContain er"));
31 shouldThrow("range.compareBoundaryPoints(Range.START_TO_END, range)", ex ecute("compareBoundaryPoints"));
32 shouldThrow("range.comparePoint(document.getElementById('b1'), 1)", exec ute("comparePoint"));
33 shouldThrow("range.createContextualFragment('p')", execute("createContex tualFragment"));
34 shouldThrow("range.deleteContents()", execute("deleteContents"));
35 shouldThrow("range.detach()", execute("detach"));
36 shouldThrow("range.endContainer", read("endContainer"));
37 shouldThrow("range.endOffset", read("endOffset"));
38 shouldThrow("range.extractContents()", execute("extractContents"));
39 shouldThrow("range.insertNode(document.getElementById('b1'))", execute(" insertNode"));
40 shouldThrow("range.intersectsNode(document.getElementById('b1'))", execu te("intersectsNode"));
41 shouldThrow("range.isPointInRange(document.getElementById('b1'), 0)", ex ecute("isPointInRange"));
42 shouldThrow("range.selectNode(document.getElementById('b1'))", execute(" selectNode"));
43 shouldThrow("range.selectNodeContents(document.getElementById('b1'))", e xecute("selectNodeContents"));
44 shouldThrow("range.setEnd(document.getElementById('b1'), 0)", execute("s etEnd"));
45 shouldThrow("range.setStart(document.getElementById('b1'), 0)", execute( "setStart"));
46 shouldThrow("range.startContainer", read("startContainer"));
47 shouldThrow("range.startOffset", read("startOffset"));
48 shouldThrow("range.surroundContents(document.getElementById('b1'))", exe cute("surroundContents"));
49 shouldThrow("range.toString()", execute("toString"));
50 </script>
51 </body>
52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698