W3C home > Mailing lists > Public > www-archive@w3.org > March 2008

Re: IE8 incompatibility issues (was: Re: Issue: IE 8 adds new DOM Properties for ARIA -- not compatible with other impls)

From: Simon Pieters <simonp@opera.com>
Date: Sat, 15 Mar 2008 14:55:45 +0100
To: "Chris Wilson" <Chris.Wilson@microsoft.com>, "Marc Silbey" <marcsil@windows.microsoft.com>, "Anne van Kesteren" <annevk@opera.com>, "Dave Pawson" <dave.pawson@gmail.com>, "w3c-wai-pf@w3.org" <w3c-wai-pf@w3.org>
Cc: "Cullen Sauls" <cullens@microsoft.com>, "Jon Gunderson" <jongund@uiuc.edu>, "Aaron M Leventhal" <aleventh@us.ibm.com>, "Charles McCathieNevile" <chaals@opera.com>, "David Poehlman" <poehlman1@comcast.net>, "www-archive@w3.org" <www-archive@w3.org>, "Richard Schwerdtfeger" <schwer@us.ibm.com>
Message-ID: <op.t718y7yuidj3kv@hp-a0a83fcd39d2.belkin>

On Fri, 14 Mar 2008 18:47:34 +0100, Chris Wilson  
<Chris.Wilson@microsoft.com> wrote:

> Simon Pieters [mailto:simonp@opera.com] wrote:
>> I understand that IE works this way internally, but this behavior --  
>> that
>> all attributes are reflected by DOM attributes and that any DOM  
>> attributes
>> (or JS properties) on elements also turn into real attributes -- is not
>> backed up by any DOM spec, and Opera, Safari and Firefox don't do this.  
>> In
>> those browsers, unknown attributes are only accessible with
>> getAttribute(), and saying elm.foobar = 'x' just creates a JS property
>> "foobar" without adding/changing the "foobar" attribute on the element.
>
> IIRC, this does not necessarily happen with unknown attributes - only  
> with known attributes.  If it's a known attribute, it gets reflected  
> into the DOM with camelCasing.

The hyphenation/camelCasing part seems to be special-cased. Unknown  
attributes with dashes in them are still reflected as JS properties,  
available using ['foo-bar'] syntax, and .fooBar turns into fooBar=''.


> If it's an unknown/unrecognized attribute, it is only accessible via  
> getAttribute().

This doesn't seem to be the case in IE8, AFAICT:

    http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A%3Cbody%20foo%3Dx%3E%3Cpre%3E%0D%0A%3Cscript%3E%0D%0Adocument.body.bar%3D'y'%3B%0D%0Adocument.writeln(document.body.getAttribute('bar')%20%3F%20'FAIL%3A%20.bar%20turned%20into%20real%20attribute'%20%3A%20'PASS')%3B%0D%0Adocument.writeln(document.body.foo%20%3F%20'FAIL%3A%20%26lt%3Bbody%20foo%3Dx%3E%20turned%20into%20a%20JS%20property'%20%3A%20'PASS')%3B%0D%0A%3C%2Fscript%3E

-- 
Simon Pieters
Opera Software
Received on Saturday, 15 March 2008 13:57:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:18:13 GMT