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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Range/surroundContents-1.html

Issue 2745443003: DOM Range: surroundContents() should not check if newParent is in ancestors beforehand. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
(Empty)
1 <p>This tests for HIERARCHY_REQUEST_ERRs when calling Range::surroundContents.</ p>
2 <div id="select" style="border: 1px solid blue;">Hello world.</div>
3 <div id="insert" style="border: 1px solid red;"></div>
4 <ul id="console"></ul>
5 <script>
6 function log(str) {
7 var li = document.createElement("li");
8 li.appendChild(document.createTextNode(str));
9 var console = document.getElementById("console");
10 console.appendChild(li);
11 }
12
13 var range = document.createRange();
14 var select = document.getElementById("select");
15 var text = select.firstChild;
16
17 var insert = document.getElementById("insert");
18
19 range.setStart(text, 0);
20 range.setEnd(text, text.length);
21
22 try {
23 range.surroundContents(select);
24 } catch (e) {
25 var error = "HierarchyRequestError: Failed to execute 'surroundContents' on 'Range': The node provided contains the insertion point; it may not be inserted into itself.";
26 if (e != error)
27 log ("Failure, expected: " + error + "Was " + e);
28 }
29
30 try {
31 range.surroundContents(insert);
32 } catch (e) {
33 log ("Failure: " + error);
34 }
35 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698