4 <script src=
"../resources/js-test.js"></script>
6 <body id=
"static_eventTarget">
8 <p id=
"p">One paragraph in the document
</p>
10 <div id=
"console"></div>
12 description("Tests that a 'selected text changed' notification fires on a contentEditable element when the user moves the cursor within it.");
13 window
.jsTestIsAsync
= true;
16 // This forces building the accessibility tree, because selection change
17 // events only fire on elements that already exist.
18 accessibilityController
.accessibleElementById('dummy');
20 var axElement
= accessibilityController
.rootElement
;
22 axElement
.addNotificationListener(function(notification
) {
23 if (notification
== 'SelectedTextChanged') {
24 debug('Got SelectedTextChanged notification on root element.');
25 axElement
.removeNotificationListener();
30 var p
= document
.getElementById('p');
31 var range
= document
.createRange();
32 range
.setStart(p
.firstChild
, 0);
33 range
.setEnd(p
.firstChild
, 1);
34 window
.getSelection().removeAllRanges();
35 window
.getSelection().addRange(range
);
38 if (window
.testRunner
&& window
.accessibilityController
) {
39 testRunner
.dumpAsText();
40 window
.onload
= runTest();