Bug 26901
Summary: | Cannot set the length of a select to zero using javascript. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Gene Chow <gene> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Major | ||
Priority: | P1 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.5 |
Gene Chow
The options array for a select cannot be cleared. The code below does not work as expected using Safari 4.01 (5530.18).
-----------
<html>
<head>
<script type="text/javascript">
function load() {
var sel = document.getElementById("select");
for (var i = 0; i < 20; i++) {
var opt = new Option('option '+i, i, false, false);
sel.options[sel.length] = opt;
}
alert(sel.length);
sel.length = 0;
alert(sel.length);
sel.options.length = 0;
alert(sel.options.length);
}
</script>
</head>
<body onload="load()">
<select id="select"></select>
</body>
</html>
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Could you please clarify why this bug was marked as INVALID?