Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / selectstart-prevent-selectall.html
blobea84f43410d50062254e0e0238eba8be345328ca
1 <!DOCTYPE html>
2 <html>
3 <body onselectstart="event.preventDefault();">
4 <p>This test ensures selectstart event fires when selecting all and script can prevent the selection change.</p>
5 <section id="test">
6 <div onselectstart="handlerOnDivWasCalled = true;" contenteditable>hello</div>
7 <input onselectstart="event.preventDefault();" type="text" value="world">
8 </section>
9 <pre><script>
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.dumpEditingCallbacks();
16 var handlerOnDivWasCalled = false;
17 var div = document.getElementsByTagName('div')[0];
18 div.focus();
19 window.getSelection().collapse(div.firstChild, 1);
20 document.execCommand('SelectAll', false, null);
21 var range = window.getSelection().getRangeAt(0);
22 document.write('div: ');
23 if (!handlerOnDivWasCalled)
24 document.writeln('FAIL - handler on div was never called');
25 else if (range.startOffset != 1 || range.endOffset != 1)
26 document.writeln('FAIL - selection changed');
27 else
28 document.writeln('PASS');
30 var input = document.getElementsByTagName('input')[0];
31 input.focus();
32 input.selectionStart = 1;
33 input.selectionEnd = 1;
34 document.execCommand('SelectAll', false, null);
35 document.writeln('input: ' + (input.selectionStart == 1 || input.selectionEnd == 1 ? 'PASS' : 'FAIL'));
37 document.getElementById('test').style.display = 'none';
39 </script></pre>
40 </body>
41 </html>