Bug 182279 - select.add() should have the second parameter optional. r=smaug

This commit is contained in:
Makoto Kato 2011-06-22 16:33:30 +09:00
parent 0459d9e1ab
commit f8772e188e
3 changed files with 39 additions and 2 deletions

View File

@ -80,6 +80,7 @@ _TEST_FILES = \
test_bug109445.html \
test_bug109445.xhtml \
test_bug143220.html \
test_bug182279.html \
test_bug237071.html \
bug242709_iframe.html \
bug242709_load.html \

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=182279
-->
<head>
<title>Test for Bug 182279</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=182279">Moozilla Bug 182279</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 182279 **/
var sel = document.createElement("select");
var opt1 = new Option();
var opt2 = new Option();
var opt3 = new Option();
opt1.value = 1;
opt2.value = 2;
opt3.value = 3;
sel.add(opt1, null);
sel.add(opt2, opt1);
sel.add(opt3);
is(sel[0], opt2, "1st item should be 2");
is(sel[1], opt1, "2nd item should be 1");
is(sel[2], opt3, "3rd item should be 3");
</script>
</pre>
</body>
</html>

View File

@ -53,7 +53,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(58cd01b8-c3f2-4e58-b39d-8a0ba941717e)]
[scriptable, uuid(5aeb2480-cb21-4483-b9b3-0c914502eb81)]
interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
{
attribute boolean autofocus;
@ -70,7 +70,7 @@ interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
nsIDOMNode item(in unsigned long index);
nsIDOMNode namedItem(in DOMString name);
void add(in nsIDOMHTMLElement element,
in nsIDOMHTMLElement before)
[optional] in nsIDOMHTMLElement before)
raises(DOMException);
void remove(in long index);