[Webkit-unassigned] [Bug 76389] New: Form select option not de-selecting
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jan 16 09:43:30 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=76389
Summary: Form select option not de-selecting
Product: WebKit
Version: 312.x
Platform: PC
OS/Version: Windows Vista
Status: UNCONFIRMED
Severity: Minor
Priority: P2
Component: HTML DOM
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: buy12 at netcasters.com
Hi,
I have a form select object that has size = 20 and no "multiple" attribute defined and has nothing selected.
This results in the first option being selected, which is wrong:
-----------------------------------------------------------------------------------
alert(select.getAttribute('multiple') // null
select.options[1].selected = true;
select.options[1].selected = false;
alert(select.options[0].selected); // true in chrome (16) and safari (5.1)
-----------------------------------------------------------------------------------
But, setting attribute 'multiple' to '', makes everything ok:
-----------------------------------------------------------------------------------
select.setAttribute('multiple','');
alert(select.getAttribute('multiple') // ''
select.options[1].selected = true;
select.options[1].selected = false;
alert(select.options[0].selected); // false, which is correct
-----------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body onload="test()">
<form name="form1" action="">
<select name="user" size="20">
<option value="1">one</option>
<option value="2">two</option>
</select>
</form>
<script type="text/javascript">
function test () {
var select = document.form1.user;
select.options[1].selected = true;
select.options[1].selected = false;
}
</script>
</body></html>
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list