summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/execCommand/insertHorizontalRule.html
blob: 78a38ba6d75983478e53c3631ec6b175a1ed5c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<script>
if (window.testRunner)
     testRunner.dumpEditingCallbacks();
</script>
<p>These are tests for execCommand(InsertHorizontalRule).</p>

<p>This test inserts an hr between 'foo' and 'bar'.</p>
<div id="test1" contenteditable="true">foobar</div>

<p>This test inserts an hr with id="hr" between 'foo' and 'bar', fetches the hr using its id, then removes it.</p>
<div id="test2" contenteditable="true">foobar</div>

<script type="text/javascript" src="../editing.js"></script>
<script>
var s = window.getSelection();
var e;

e = document.getElementById("test1");
s.collapse(e, 0);
moveSelectionForwardByCharacterCommand();
moveSelectionForwardByCharacterCommand();
moveSelectionForwardByCharacterCommand();
document.execCommand("InsertHorizontalRule", false, "");

e = document.getElementById("test2");
s.collapse(e, 0);
moveSelectionForwardByCharacterCommand();
moveSelectionForwardByCharacterCommand();
moveSelectionForwardByCharacterCommand();
var id = "hr";
document.execCommand("InsertHorizontalRule", false, id);
var hr = document.getElementById(id);
hr.parentNode.removeChild(hr);
</script>