[whatwg] Detecting Web Forms for future proof scripts?
Lachlan Hunt
lachlan.hunt at lachy.id.au
Mon Oct 2 16:57:34 PDT 2006
Hallvord R M Steen wrote:
> On 02/10/06, Ric Hardacre <ric at hardacre.org> wrote:
>> suppose for example I wanted to emulate the
>> datalist element for a text box. I can use the DOM and some on-the fly
>> CSS to build a Javascript emulated datalist, but how would one go about
>> ensuring that if/when it encounters a browser that can handle the
>> datalist that it does not execute?
>
> What about this attempt?
>
> http://www.hallvord.com/opera/demo/wf2-datalist.htm
It's easier to just check for the interface.
if (window.HTMLDataListElement) {
// datalist is supported.
}
However, thanks to a bug in Opera 9, you have do this:
if (window.HTMLDataListElement || window.HTMLDatalistElement) {
// datalist is supported.
}
The first is what the spec defined, the second is what Opera initially
implemented, but it's being fixed.
--
Lachlan Hunt
http://lachy.id.au/
More information about the whatwg
mailing list