[whatwg] hasFeature() When Only 1 Syntax is Supported

On Mon, 22 Jun 2009 08:31:54 +0200, Simon Pieters <simonp at opera.com> wrote:

> On Sat, 20 Jun 2009 18:34:38 +0200, Smylers <Smylers at stripey.com> wrote:
>
>> The current text suggests that a user-agent may choose to support only
>> the HTML syntax (not XHTML) but should still return true for
>> hasFeature("XHTML", "5.0").
>>
>> If that isn't intended then the requirements for hasFeature() should be
>> changed to depend on the syntaxes chosen to be implemented.  If it _is_
>> intended (and given various things browsers have to do for web
>> compatibility, it wouldn't surprise me) then perhaps it would be better
>> to spell this out explicitly, since it's counter-intuitive.
>>
>> hasFeature() currently has the implementation requirements:
>>
>>   User agents should respond with a true value when the hasFeature
>>   method is queried with these values.
>>
>>     -- http://www.whatwg.org/html5#dom-feature-strings:
>>
>> Where "these values" are ("HTML", "5.0") and ("XHTML", "5.0").
>>
>> However while supporting both HTML and XHTML is "encouraged",
>> user-agents "may" choose to support only one of them:
>>
>>   http://www.whatwg.org/html5#conformance-requirements
>
> Maybe the spec should remove these feature strings altogether and  
> encourage authors to use more accurate methods of detecting support.

The spec is now gaining all the remaining stuff from DOM2 HTML, so this  
note is incorrect:

"Note: The interfaces defined in this specification are not always  
supersets of the interfaces defined in DOM2 HTML; some features that were  
formerly deprecated, poorly supported, rarely used or considered  
unnecessary have been removed. Therefore it is not guaranteed that an  
implementation that supports "HTML" "5.0" also supports "HTML" "2.0"."

I'm thinking that the spec should maybe just use "2.0" instead of "5.0",  
since it's what browsers do and there might be pages that check for this.

Meanwhile it seems useful to return false as appropriate if the UA only  
allows one of the syntaxes, as Smylers points out.

-- 
Simon Pieters
Opera Software

Received on Wednesday, 24 June 2009 03:53:40 UTC