This question is moot - see @Alochi comments. my bad.
This is different than button
in that button
is a defined tag in the specs, whereas ot开发者_高级运维her types, date, tel, password, hidden, ...
, are not but in practice can be used to create html. (this is the best link I can find).
from my experiments, on modern browsers the following are equivalent:
a = document.createElement('input');
a.type = 'date';
b = document.createElement('date');
a
and b
render the same and have the same attributes. wrong!! do not render the same
the big difference is that querySelector
is strict - even though date
might be equivalent to input[type='date']
functionally, an element created with date
will not be found with input[type='date']
and vice versa.
in dealing with these guys it seems like we're going to need two sets queries if we're looking for them - or is there some superset that makes it easier?
is this a case where implementers are outrunning the specs? it seems they are migrating all of the types to their own element, much like they did with button
for example.
(assuming one does not care about legacy browsers) are there any guiding principles here?
Where did you get that about the date
tag from?
There is no such tag, look:
http://www.w3schools.com/html5/html5_reference.asp
http://dev.w3.org/html5/spec/Overview.html
in the “block level semantics”, there is only time
, in the section about forms, there is input type="date"
, as well as tags like button
, keygen
and meter
but no <date>
anywhere.
I have seen the date picker in Opera as <input type="date">
see the small box in top left at http://www.shaneofalltrades.com/electrical.html if you have Opera. I loaded this just for sample, no process with it. Also works in Safari but with only a simpler form and does not work in IE9 or Firefox 6.
精彩评论