[whatwg] Improve select required

Jesse McCarthy whatwg-2010-04 at jessemccarthy.net
Mon Sep 13 11:20:43 PDT 2010


On Monday 13 Sep 2010 Mounir Lamouri wrote:
> 2. Introduce a placeholder boolean attribute for <option> and select
elements will suffer from being missing if there are no options selected
or selected options all have the placeholder attribute set.

I also wonder if that would be more straighforward.  I suggested / inquired 
about that when this was being discussed before, but the discussion petered 
out and no one said anything about it:

http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-August/027892.html

(See last paragraph.)


> last solution isn't [backward compatible] (ie. the placeholder text 
> wouldn't be shown). However, a workaround can be found using javascript:

In my opinion, something that relies on scripting isn't a viable solution.


> Solution 3, seems to be the nicest and is consistent with the other part
of the specifications (placeholder would be used in <input> and <select>).

That's not viable now because it's not backward compatible, but if people 
think that would be the ideal solution in the future, would it feasible to 
specify and implement the following authoring requirements and user agent 
behavior?

* @placeholder for SELECT (as in your #3)

AND

* @placeholder as a boolean attribute on OPTION (just as a crutch for 
backward compatibility)

AND

* @placeholder on OPTION is only valid when @placeholder is also used on the 
SELECT (and perhaps only if the OPTION's textContent matches the value of 
the SELECT's @placeholder attribute?)

AND

* Although @placeholder on OPTION is valid / tolerated under those 
circumstances, conforming UAs must ignore those OPTIONs entirely and use the 
value of @placeholder on the SELECT


If that's doable, then implementors could implement the behavior for 
@placeholder on SELECT now and authors could author documents that use the 
new mechanism and preserve the status-quo for HTML 4 user agents -- an 
initial "label" OPTION.  When authors stop caring about HTML 4 UAs, they can 
just stop including an OPTION with @placeholder.

Jesse




More information about the whatwg mailing list