[Webkit-unassigned] [Bug 159058] REGRESSION: options property of a multiple HTMLSelectElement has duplicate items
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Jun 26 11:06:01 PDT 2016
https://bugs.webkit.org/show_bug.cgi?id=159058
--- Comment #6 from David Gasperoni <mcdado at gmail.com> ---
(In reply to comment #4)
> So it seems it is just the WebInpector output that is confusing:
> select.options.length is 45
> select.length is 45
>
> However if you display select.options in WebInspector you see more.
>
> I'll try and figure out why this happens. I am also CC'ing a few
> WebInspector people.
I have to say that I stumbled on this bug with a loop like this:
function add_attr_multiple()
{
var attr = document.getElementById('attribute_group');
var length = attr.length || 0;
for (var i = 0; i < length; ++i)
{
elem = attr.options[i];
if (elem.selected)
{
// Do stuff...
}
}
}
And if the selected elements are at the end of the list, they are never reached because 'length' is 45, but attr.options is much longer (because of duplicates) so 'i' is not high enough to access those elements. This happens with the Web Inspector closed.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160626/65e2b05d/attachment.html>
More information about the webkit-unassigned
mailing list