W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

hasFeature continued

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 12 Jul 2001 13:26:24 -0600
Message-ID: <70E215722F6AD511820A000103D141D40AA441@thor.aeathtl.com>
To: "'www-dom@w3.org'" <www-dom@w3.org>
I've been able to do a little testing with Microsoft's implementation, unfortunately testing Netscape will have to come later.

Trying to use hasFeature with an "unspecified" version, runs into a catch 22.

MSXML's implementation is defined in terms of a COM BSTR.  Accessed from C++, you can pass in NULL as the value for the BSTR.  However, it is not possible to make a call from Visual Basic or JScript
that calls the COM interface with a BSTR value of NULL.

The MSXML implementation will return true for impl.hasFeature("XML",null) (in languages that can do that) but will return false for empty strings.

So from JScript or VB:

impl.hasFeature("XML","1.0")  -  true
impl.hasFeature("XML","")     -  
    false, no special significance given to empty string
impl.hasFeature("XML",null)   
impl.hasFeature("XML",undefined) -
    exception raised before call since 
    null or undefined cannot be coersced to a string
impl.hasFeature("XML") -
    wrong number of arguments

The only pattern that would work across all languages is a empty string.

For languages where null is an allowable value for String (for example, Java but not VB or ECMAScript) then defining the behavior to be identical to empty string would be helpful, but nearly
impossible to write succinctly.

Maybe:

This is the version number of the feature to test. In Level 2, the string can be either "2.0" or "1.0". If the version is an empty string (or a null string when the value space of the string type
contains such a value), supporting any version of the feature causes the method to return true. 
Received on Thursday, 12 July 2001 15:30:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT