2 <script type=
"text/javascript">
4 function print(message
)
6 var paragraph
= document
.createElement("div");
8 paragraph
.appendChild(document
.createElement("br"));
10 paragraph
.appendChild(document
.createTextNode(message
));
11 document
.getElementById("console").appendChild(paragraph
);
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
19 testElement(document
.getElementById("textarea"));
20 testElement(document
.getElementById("input"));
23 function testElement(element
)
26 element
.value
= "This is a test value.";
27 element
.setSelectionRange(3,7);
29 if (element
.selectionStart
== 3)
32 print("Failed, selection of " + element
+ " is " + element
.selectionStart
+ "-" + element
.selectionEnd
+ ".");
38 <body onload=
"test();">
39 <p>This test checks if a call to focus on an already-focused element causes a change in selection.
</p>
40 <p>If the test passes for both textarea and text input elements you'll see two messages saying
"passed" below.
</p>
45 <p><textarea id=
"textarea" cols=
"20"></textarea></p>
46 <p><input type=
"text" id=
"input" size=
"20"></p>