- From: Geoffrey Sneddon <gsneddon@opera.com>
- Date: Thu, 12 Nov 2009 17:39:28 +0100
- To: HTML WG <public-html@w3.org>
Hi, Given the following HTML document: <!doctype html> <select></select> <script> var s = document.getElementsByTagName('select')[0]; s.selectedIndex = 0; s.options[s.options.length] = new Option(); alert(s.selectedIndex); </script> At the moment the spec says we should alert -1. At the moment Opera alerts -1, and all other browsers alert 0. If you comment out the creation of the object, all give -1. <http://www.ticketmaster.com/> relies upon it giving 0, so Opera's behaviour is going to have to change to match other browsers, leaving HTML 5 in a state where nothing matches the spec. It'd seem silly for the spec to stay in such a state. I think the behaviour needed is that setting selectedIndex stores its value in a buffer if it doesn't already exist, and then acts as if it had just been set when the option is added. (Probably spec'd some totally different way, but that's the basic change.) -- Geoffrey Sneddon — Opera Software <http://gsnedders.com/> <http://www.opera.com/>
Received on Thursday, 12 November 2009 16:40:02 UTC