Re: HTML Extensibility Through Script

2007/7/12, Ben Boyle:
>
> I would like to know what can be used to detect native support for the
> new input@type values (e.g. date) so javascript can be used to do
> something useful in legacy UAs based on those types but browsers that
> implement their own widgets are left peacefully alone.

You can compare input.type with input.getAttribute("type").
In Opera 9.21 (which supports type=date), both return "date".
In Firefox and IE7, input.type returns "text" while
input.getAttribute("type") is "date".

> I don't know if this is possible with DOMImplementation.hasFeature()
> or not (but I'd like it to be - a good standards based approach).

It is: http://www.whatwg.org/specs/web-forms/current-work/#dom
<script>
alert(document.implementation.hasFeature("WebForms", "2.0"));
</script>

-- 
Thomas Broyer

Received on Thursday, 12 July 2007 19:38:25 UTC