W3C home > Mailing lists > Public > public-html@w3.org > July 2007

Re: Detecting support for a given HTML5 feature through JS

From: Maciej Stachowiak <mjs@apple.com>
Date: Sun, 15 Jul 2007 22:38:02 -0700
Cc: "public-html@w3.org" <public-html@w3.org>
Message-Id: <BBCF4DC7-ECC0-45B3-B81D-BAB732386C03@apple.com>
To: Doug Schepers <schepers@w3.org>

On Jul 15, 2007, at 3:21 PM, Doug Schepers wrote:

> Hi, Henri-
> Henri Sivonen wrote:
>> On Jul 15, 2007, at 20:40, Jon Barnett wrote:
>>> Hixie pointed out that you can detect support for certain features
>>> using Javascript [1], such as writing PING as uppercase in the DOM,
>>> and then checking the HTMLAnchorElement.ping property  
>>> (lowercase).  I
>>> suspect the same logic can apply to new input/@type values - use
>>> <input type="date">, and then check the HTMLInputElement.type  
>>> property
>>> for either "date" or "text".
>> This is the best way because the test for the existence of the  
>> implementation involves testing the implementation itself.
> In certain cases, this is a reasonable statement.  But it isn't  
> universally applicable.  For instance, if you'll look at another  
> MathML testcase [1], you'll see the problem.

Testing for the property or method directly is the best way to test  
for DOM interfaces (it's more fine-grained than anything hasFeature  
will give you) but it doesn't  seem that great a way to test for  
implementation of markup interfaces and attributes. However, this is  
only relevant for elements and attributes that have a rendering effect  
which can't be seen in CSS, or a behavior effect that is not tied to  
any scripting interfaces. For HTML5 itself, I think that is a pretty  
small subset.

Received on Monday, 16 July 2007 05:38:10 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:24 UTC