import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1 @@
{"original_id":"textFieldSelection"}

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>text field selection: select()</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<textarea>foobar</textarea>
<script>
var input_types = ["text", "search", "tel", "url", "password"],
t1 = async_test("select() on textarea queues select event"),
q1 = false;
input_types.forEach(function(type) {
var input = document.createElement("input"),
t = async_test("select() on input type " + type + " queues select event"),
q = false;
t.step(function() {
input.type = type;
input.value = "foobar";
document.body.appendChild(input);
input.onselect = t.step_func_done(function(e) {
assert_true(q, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_true(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
});
input.select();
q=true;
});
});
document.querySelector("textarea").onselect = t1.step_func_done(function(e) {
assert_true(q1, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_true(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
});
t1.step(function() {
document.querySelector("textarea").select();
q1=true;
});
</script>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<title>Selection indices after content change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var input = document.createElement("input");
input.focus();
input.value = "something something something dark side";
input.setSelectionRange(4,20);
assert_equals(input.selectionStart, 4);
assert_equals(input.selectionEnd, 20);
input.value = "It's a trap!";
assert_equals(input.selectionStart, input.value.length);
assert_equals(input.selectionEnd, input.value.length);
}, "Selection indices after reseting content");
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>text field selection (textarea)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var el = document.createElement("textarea");
assert_equals(el.selectionStart, 0);
assert_equals(el.selectionEnd, 0);
el.selectionStart = 1;
el.selectionEnd = 1;
el.selectionDirection = "forward";
el.setRangeText("foobar");
el.setSelectionRange(0, 1);
}, "text field selection for the input textarea");
</script>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>text field selection</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var types = ["hidden", "email", "datetime-local", "date", "month", "week", "time", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]; //types for which the API doesn't apply
var types2 = ["text", "search", "tel", "url", "password"]; //types for which the API applies
types.forEach(function(type){
test(function(){
var el = document.createElement("input");
el.type = type;
assert_throws("InvalidStateError", function(){
el.selectionStart;
});
assert_throws("InvalidStateError", function(){
el.selectionEnd;
});
assert_throws("InvalidStateError", function(){
el.selectionDirection;
});
assert_throws("InvalidStateError", function(){
el.setRangeText("foobar");
});
assert_throws("InvalidStateError", function(){
el.setSelectionRange(0, 1);
});
}, "text field selection for the input " + type);
});
types2.forEach(function(type) {
test(function() {
var el = document.createElement("input");
el.type = type;
assert_equals(el.selectionStart, 0);
assert_equals(el.selectionEnd, 0);
el.selectionStart = 1;
el.selectionEnd = 1;
el.selectionDirection = "forward";
el.setRangeText("foobar");
el.setSelectionRange(0, 1);
}, "text field selection for the input " + type);
});
</script>

View file

@ -0,0 +1,145 @@
<!DOCTYPE HTML>
<title>test if select() API returns correct attributes</title>
<meta charset="UTF-8">
<meta name="timeout" content="long">
<link rel="author" title="Koji Tashiro" href="mailto:koji.tashiro@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/association-of-controls-and-forms.html#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var body = document.getElementsByTagName("body").item(0);
var dirs = ['forward', 'backward', 'none'];
var sampleText = "0123456789";
var createInputElement = function(value) {
var el = document.createElement("input");
el.type = "text";
el.value = value;
body.appendChild(el);
return el;
};
var createTextareaElement = function(value) {
var el = document.createElement("textarea");
el.value = value;
body.appendChild(el);
return el;
};
test(function() {
var text = 'a';
for (var i=0; i<255; i++) {
var el = createInputElement(text);
el.select();
var selectionText = el.value.substring(el.selectionStart, el.selectionEnd);
assert_equals(selectionText, text, "Selection text mismatched");
el.parentNode.removeChild(el);
text += 'a';
}
}, "test if selection text is correct for input");
test(function() {
var text = 'a';
for (var i=0; i<255; i++) {
var el = createTextareaElement(text);
el.select();
var selectionText = el.value.substring(el.selectionStart, el.selectionEnd);
assert_equals(selectionText, text, "Selection text mismatched");
el.parentNode.removeChild(el);
text += 'a';
}
}, "test if selection text is correct for textarea");
test(function() {
var text = 'あ';
for (var i=0; i<255; i++) {
var el = createInputElement(text);
el.select();
var selectionText = el.value.substring(el.selectionStart, el.selectionEnd);
assert_equals(selectionText, text, "Selection text mismatched");
el.parentNode.removeChild(el);
text += 'あ';
}
}, "test if non-ascii selection text is correct for input");
test(function() {
var text = 'あ';
for (var i=0; i<255; i++) {
var el = createTextareaElement(text);
el.select();
var selectionText = el.value.substring(el.selectionStart, el.selectionEnd);
assert_equals(selectionText, text, "Selection text mismatched");
el.parentNode.removeChild(el);
text += 'あ';
}
}, "test if non-ascii selection text is correct for textarea");
test(function() {
var el = createInputElement(sampleText);
// If there is no selection, then it must return the offset(in logical order)
// to the character that immediately follows the text entry cursor.
assert_equals(el.selectionStart, el.value.length, "SelectionStart offset without selection");
el.select();
assert_equals(el.selectionStart, 0, "SelectionStart offset");
el.parentNode.removeChild(el);
}, "test SelectionStart offset for input");
test(function() {
var el = createTextareaElement(sampleText);
// If there is no selection, then it must return the offset(in logical order)
// to the character that immediately follows the text entry cursor.
assert_equals(el.selectionStart, el.value.length, "SelectionStart offset without selection");
el.select();
assert_equals(el.selectionStart, 0, "SelectionStart offset");
el.parentNode.removeChild(el);
}, "test SelectionStart offset for textarea");
test(function() {
var el = createInputElement(sampleText);
// If there is no selection, then it must return the offset(in logical order)
// to the character that immediately follows the text entry cursor.
assert_equals(el.selectionEnd, el.value.length, "SelectionEnd offset without selection");
el.select();
assert_equals(el.selectionEnd, el.value.length, "SelectionEnd offset");
el.parentNode.removeChild(el);
}, "test SelectionEnd offset for input");
test(function() {
var el = createTextareaElement(sampleText);
// If there is no selection, then it must return the offset(in logical order)
// to the character that immediately follows the text entry cursor.
assert_equals(el.selectionEnd, el.value.length, "SelectionEnd offset without selection");
el.select();
assert_equals(el.selectionEnd, el.value.length, "SelectionEnd offset");
el.parentNode.removeChild(el);
}, "test SelectionEnd offset for textarea");
test(function() {
var el = createInputElement(sampleText);
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.select();
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.parentNode.removeChild(el);
}, "test SelectionDirection for input");
test(function() {
var el = createInputElement(sampleText);
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.select();
assert_in_array(el.selectionDirection, dirs, "SelectionDirection");
el.parentNode.removeChild(el);
}, "test SelectionDirection for textarea");
</script>

View file

@ -0,0 +1,120 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>text field selection: setRangeText</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#display_none {display:none;}
</style>
<div id="log"></div>
<input type=text id=text value="foobar">
<input type=search id=search value="foobar">
<input type=tel id=tel value="foobar">
<input type=url id=url value="foobar">
<input type=password id=password value="foobar">
<input id=display_none value="foobar">
<textarea id=textarea>foobar</textarea>
<script>
var input = document.createElement("input");
input.id = "input_not_in_doc";
input.value = "foobar";
var elements = [
document.getElementById("text"),
document.getElementById("search"),
document.getElementById("tel"),
document.getElementById("url"),
document.getElementById("password"),
document.getElementById("display_none"),
document.getElementById("textarea"),
input,
]
elements.forEach(function(element) {
test(function() {
element.value = "foobar";
element.selectionStart = 0;
element.selectionEnd = 3;
assert_equals(element.selectionStart, 0);
assert_equals(element.selectionEnd, 3);
element.setRangeText("foobar2");
assert_equals(element.value, "foobar2bar");
assert_equals(element.selectionStart, 0);
assert_equals(element.selectionEnd, 7);
element.setRangeText("foobar3", 7, 10);
assert_equals(element.value, "foobar2foobar3");
}, element.id + " setRangeText with only one argument replaces the value between selectionStart and selectionEnd, otherwise replaces the value between 2nd and 3rd arguments");
test(function(){
element.value = "foobar";
element.selectionStart = 0;
element.selectionEnd = 0;
element.setRangeText("foobar2", 0, 3); // no 4th arg, default "preserve"
assert_equals(element.value, "foobar2bar");
assert_equals(element.selectionStart, 0);
assert_equals(element.selectionEnd, 0);
}, element.id + " selectionMode missing");
test(function(){
element.value = "foobar"
element.setRangeText("foo", 3, 6, "select");
assert_equals(element.value, "foofoo");
assert_equals(element.selectionStart, 3);
assert_equals(element.selectionEnd, 6);
}, element.id + " selectionMode 'select'");
test(function(){
element.value = "foobar"
element.setRangeText("foo", 3, 6, "start");
assert_equals(element.value, "foofoo");
assert_equals(element.selectionStart, 3);
assert_equals(element.selectionEnd, 3);
}, element.id + " selectionMode 'start'");
test(function(){
element.value = "foobar"
element.setRangeText("foobar", 3, 6, "end");
assert_equals(element.value, "foofoobar");
assert_equals(element.selectionStart, 9);
assert_equals(element.selectionEnd, 9);
}, element.id + " selectionMode 'end'");
test(function(){
element.value = "foobar"
element.selectionStart = 0;
element.selectionEnd = 5;
assert_equals(element.selectionStart, 0);
element.setRangeText("", 3, 6, "preserve");
assert_equals(element.value, "foo");
assert_equals(element.selectionStart, 0);
assert_equals(element.selectionEnd, 3);
}, element.id + " selectionMode 'preserve'");
test(function(){
assert_throws("INDEX_SIZE_ERR", function() {
element.setRangeText("barfoo", 2, 1);
});
}, element.id + " setRangeText with 3rd argument greater than 2nd argument throws an IndexSizeError exception");
test(function(){
assert_throws(new TypeError(), function() {
element.setRangeText();
});
}, element.id + " setRangeText without argument throws a type error");
async_test(function() {
var q = false;
element.onselect = this.step_func_done(function(e) {
assert_true(q, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_false(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
});
element.setRangeText("foobar2", 0, 6);
q = true;
}, element.id + " setRangeText fires a select event");
})
</script>

View file

@ -0,0 +1,274 @@
<!DOCTYPE HTML>
<title>Test of text field setSelectionRange</title>
<link rel="author" title="Takeharu.Oshida" href="mailto:georgeosddev@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea/input-setselectionrange">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="hide" style="display: block">
<input id="a" type="text" value="abcde">
<textarea id="b">abcde</textarea>
</div>
<script>
test(function() {
var input = document.getElementById("a");
test(function() {
assert_equals(typeof(input.setSelectionRange), "function", "element must have 'setSelectionRange' function");
},"input typeof(input.setSelectionRange)'");
test(function() {
assert_equals(input.setSelectionRange(0,1,"forward"),undefined,"setSelectionRange is void functuon");
},"input setSelectionRange return void");
test(function() {
input.setSelectionRange(0,1)
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(0,1)');
test(function() {
input.setSelectionRange(0,input.value.length+1)
assert_equals(input.selectionEnd, input.value.length, "Arguments greater than the length of the value of the text field must be treated as pointing at the end of the text field");
},'input setSelectionRange(0,input.value.length+1)');
test(function() {
input.setSelectionRange(input.value.length+1,input.value.length+1)
assert_equals(input.selectionStart, input.value.length, "Arguments (start) greater than the length of the value of the text field must be treated as pointing at the end of the text field");
assert_equals(input.selectionEnd, input.value.length, "Arguments (end) greater than the length of the value of the text field must be treated as pointing at the end of the text field");
},'input setSelectionRange(input.value.length+1,input.value.length+1)');
test(function() {
input.setSelectionRange(input.value.length+1,1)
assert_equals(input.selectionStart, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(input.value.length+1,input.value.length+1)');
test(function() {
input.setSelectionRange(2,2)
assert_equals(input.selectionStart, 2, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(input.selectionEnd, 2, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
},'input setSelectionRange(2,2)');
test(function() {
input.setSelectionRange(2,1)
assert_equals(input.selectionStart, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(input.selectionEnd, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
},'input setSelectionRange(2,1)');
test(function() {
input.setSelectionRange(0,1,"backward")
assert_equals(input.selectionDirection, "backward", 'The direction of the selection must be set to backward if direction is a case-sensitive match for the string "backward"');
},'input direction of setSelectionRange(0,1,"backward")');
test(function() {
input.setSelectionRange(0,1,"forward")
assert_equals(input.selectionDirection, "forward", 'The direction of the selection must be set to forward if direction is a case-sensitive match for the string "forward"');
},'input direction of setSelectionRange(0,1,"forward")');
test(function() {
input.setSelectionRange(0,1,"none")
assert_equals(input.selectionDirection, "none", 'The direction of the selection must be set to forward if direction is a case-sensitive match for the string "none"');
},'input direction of setSelectionRange(0,1,"none")');
test(function() {
input.setSelectionRange(0,1,"hoge")
assert_equals(input.selectionDirection, "none", "otherwise");
},'input direction of setSelectionRange(0,1,"hoge")');
test(function() {
input.setSelectionRange(0,1,"BACKWARD")
assert_equals(input.selectionDirection, "none", "selectionDirection should be 'none'");
},'input direction of setSelectionRange(0,1,"BACKWARD")');
test(function() {
input.setSelectionRange(0,1)
assert_equals(input.selectionDirection, "none", "if the argument is omitted");
},'input direction of setSelectionRange(0,1)');
test(function() {
input.setSelectionRange(1,-1);
assert_equals(input.selectionStart, 1, "element.selectionStart should be 1");
assert_equals(input.selectionEnd, input.value.length, "ECMAScript conversion to unsigned long");
},'input setSelectionRange(1,-1)');
test(function() {
input.setSelectionRange(-1,1);
assert_equals(input.selectionStart, 1, "ECMAScript conversion to unsigned long + if end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(-1,1)');
test(function() {
input.setSelectionRange("string",1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange("string",1)');
test(function() {
input.setSelectionRange(true,1);
assert_equals(input.selectionStart, 1, "element.selectionStart should be 1");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(true,1)');
test(function() {
input.setSelectionRange([],1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange([],1)');
test(function() {
input.setSelectionRange({},1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange({},1)');
test(function() {
input.setSelectionRange(NaN,1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(NaN,1)');
test(function() {
input.setSelectionRange(null,1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(null,1)');
test(function() {
input.setSelectionRange(undefined,1);
assert_equals(input.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(undefined,1)');
},"test of input.setSelectionRange");
async_test(function() {
var q = false;
var input = document.getElementById("a");
input.addEventListener("select", this.step_func_done(function(e) {
assert_true(q, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_true(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
}));
input.setSelectionRange(0, 1);
q = true;
}, "input setSelectionRange fires a select event");
test(function() {
var textarea = document.getElementById("b");
test(function() {
assert_equals(typeof(textarea.setSelectionRange), "function", "element must have 'setSelectionRange' function");
},"textarea typeof(input.setSelectionRange)'");
test(function() {
assert_equals(textarea.setSelectionRange(0,1,"forward"),undefined,"setSelectionRange is void functuon");
},"textarea setSelectionRange return void");
test(function() {
textarea.setSelectionRange(0,1)
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionEnd should be 1");
},'textarea setSelectionRange(0,1)');
test(function() {
textarea.setSelectionRange(0,textarea.value.length+1)
assert_equals(textarea.selectionEnd, textarea.value.length, "Arguments greater than the length of the value of the text field must be treated as pointing at the end of the text field");
},'textarea setSelectionRange(0,textarea.value.length+1)');
test(function() {
textarea.setSelectionRange(2,2)
assert_equals(textarea.selectionStart, 2, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(textarea.selectionEnd, 2, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
},'textarea setSelectionRange(2,2)');
test(function() {
textarea.setSelectionRange(2,1)
assert_equals(textarea.selectionStart, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(textarea.selectionEnd, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
},'textarea setSelectionRange(2,1)');
test(function() {
textarea.setSelectionRange(0,1,"backward")
assert_equals(textarea.selectionDirection, "backward", 'The direction of the selection must be set to backward if direction is a case-sensitive match for the string "backward"');
},'textarea direction of setSelectionRange(0,1,"backward")');
test(function() {
textarea.setSelectionRange(0,1,"forward")
assert_equals(textarea.selectionDirection, "forward", 'The direction of the selection must be set to forward if direction is a case-sensitive match for the string "forward"');
},'textarea direction of setSelectionRange(0,1,"forward")');
test(function() {
textarea.setSelectionRange(0,1,"none")
assert_equals(textarea.selectionDirection, "none", 'The direction of the selection must be set to forward if direction is a case-sensitive match for the string "none"');
},'textarea direction of setSelectionRange(0,1,"none")');
test(function() {
textarea.setSelectionRange(0,1,"hoge")
assert_equals(textarea.selectionDirection, "none", "otherwise");
},'textarea direction of setSelectionRange(0,1,"hoge")');
test(function() {
textarea.setSelectionRange(0,1,"BACKWARD")
assert_equals(textarea.selectionDirection, "none", "selectionDirection should be 'none'");
},'textarea direction of setSelectionRange(0,1,"BACKWARD")');
test(function() {
textarea.setSelectionRange(0,1)
assert_equals(textarea.selectionDirection, "none", "if the argument is omitted");
},'textarea direction of setSelectionRange(0,1)');
test(function() {
textarea.setSelectionRange("string",1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange("string",1)');
test(function() {
textarea.setSelectionRange(true,1);
assert_equals(textarea.selectionStart, 1, "element.selectionStart should be 1");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange(true,1)');
test(function() {
textarea.setSelectionRange([],1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange([],1)');
test(function() {
textarea.setSelectionRange({},1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange({},1)');
test(function() {
textarea.setSelectionRange(NaN,1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange(NaN,1)');
test(function() {
textarea.setSelectionRange(null,1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange(null,1)');
test(function() {
textarea.setSelectionRange(undefined,1);
assert_equals(textarea.selectionStart, 0, "element.selectionStart should be 0");
assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1");
},'textarea setSelectionRange(undefined,1)');
},"test of textarea.setSelectionRange");
async_test(function() {
var q = false;
var textarea = document.getElementById("b");
textarea.addEventListener("select", this.step_func_done(function(e) {
assert_true(q, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_true(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
}));
textarea.setSelectionRange(0, 1);
q = true;
}, "textarea setSelectionRange fires a select event");
</script>