[whatwg] Detecting Web Forms for future proof scripts?

Ric Hardacre ric at hardacre.org
Mon Oct 2 08:55:20 PDT 2006


I'm attempting to write Javascript scriptlets to emulate some of the Web
Forms 2.0 spec in HTML 4 documents. Firstly, they obviously need to
degrade for non-scripting UAs, which is easy enough. Secondly they need
to check that they're running on a compatible scripting engine, just
checking for the existence of document.getElementById is the simple way
(If there are better ways then I'm always open to learning). But I'm
presented with an issue, 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? This is probably quite an open
question and yes I'm aware of the embedding-a-select-inside-the-datalist
solution to this particular example, but the general question remains:
How to script WF2 functionality for current browsers in a way that both
degrades AND yields to the UA when it can handle the functionality natively?

Ric Hardacre
http://www.cyclomedia.co.uk/



More information about the whatwg mailing list