Bug 26901 - Cannot set the length of a select to zero using javascript.
Summary: Cannot set the length of a select to zero using javascript.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.5
: P1 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-01 13:41 PDT by Gene Chow
Modified: 2009-07-08 07:29 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gene Chow 2009-07-01 13:41:59 PDT
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>
Comment 1 Alexey Proskuryakov 2009-07-08 07:29:05 PDT
Could you please clarify why this bug was marked as INVALID?