Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / mutate-unfocused-text-with-selection.html
blobc193d12b5ce06c7a318c4678b0723b664dacaf61
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This tests modifying a text node with selection but without a focus.
5 WebKit used to automatically set the focus to the root editable element of this node but it should not.
6 You should see 'PASS' below:</p>
7 <div id="target" onfocus="target.innerText='FAIL'" contenteditable>hello</div>
8 <div id="focused" contenteditable>world</div>
9 <script>
11 var target = document.getElementById('target');
12 var focused = document.getElementById('focused');
13 focused.focus();
14 getSelection().setBaseAndExtent(target.firstChild, 1, target.firstChild, 3);
16 // The bug doesn't reproduce if this function was ran here or inside load event handler
17 setTimeout(function() {
18 target.firstChild.data = 'PASS';
19 alert('activeElement:' + document.activeElement.id); // necessary to reproduce the bug
20 }, 50);
22 </script>
23 </body>
24 </html>