OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 <body> | |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | |
5 | |
6 <p id="before">Before</p> | |
7 <div contentEditable></div> | |
8 <p id="after">After</p> | |
9 | |
10 <div id="console"></div> | |
11 <script> | |
12 description("Ensure that extending a selection skips past a contentEditable."); | |
13 | |
14 window.before = document.getElementById("before"); | |
yosin_UTC9
2013/08/31 01:00:47
nit: var before = ...
yosin_UTC9
2013/08/31 01:00:47
nit: var before = ...
dmazzoni
2013/09/05 07:57:29
Then I can't reference it in shouldBe, unless I'm
yosin_UTC9
2013/09/05 08:42:48
<div id="foo">x</div>
<script>
var foo = document.
dmazzoni
2013/09/05 17:17:21
You're right. I realized that the problem is only
| |
15 window.after = document.getElementById("after"); | |
yosin_UTC9
2013/08/31 01:00:47
nit: var after =
| |
16 | |
17 var sel = window.getSelection(); | |
18 sel.setBaseAndExtent(before, 0, before, 6); | |
19 sel.modify("extend", "forward", "character"); | |
20 shouldBe("window.getSelection().focusNode == after", "true"); | |
yosin_UTC9
2013/08/31 01:00:47
You can write
shouldBe("sel.focusNode", "after")
dmazzoni
2013/09/05 07:57:29
This doesn't work unless "sel" is a global.
As fa
yosin_UTC9
2013/09/05 08:42:48
eval() can see them.
Here is working sample:
http
| |
21 | |
22 sel.setBaseAndExtent(after, 5, after, 0); | |
23 sel.modify("extend", "backward", "character"); | |
24 shouldBe("window.getSelection().focusNode.parentElement == before", "true"); | |
yosin_UTC9
2013/08/31 01:00:47
You can write
shouldBe("sel.focusNode.paretElement
dmazzoni
2013/09/05 17:17:21
Done.
| |
25 </script> | |
26 | |
27 <script src="../../fast/js/resources/js-test-post.js"></script> | |
28 </body> | |
29 </html> | |
OLD | NEW |