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

Attributes and "Expandos"

From: Travis Leithead <travil@windows.microsoft.com>
Date: Fri, 22 Jun 2007 10:12:59 -0700
Message-ID: <096A2EC46B3C084BA8D73D2280C55DD5062B7C00@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com>
To: <ian@hixie.ch>, <public-html@w3.org>
CC: Chris Wilson <chris.wilson@microsoft.com>
Using HTML5 terminology: Current browsers today put all unknown content
attributes (namespace, name and value) into the DOM and can be [case
insensitively] retrieved via getAttribute[NS] and getAttributeNode[NS],
set via setAttribute[NS] and setAttributeNode[NS], and removed via
removeAttribute[NS] and removeAttributeNode.

 

IE, has the concept of "expandos", meaning it also creates reflecting
DOM attributes on the corresponding element for unknown content
attributes (case-sensitive). Obviously HTML5 does not define DOM
attributes for unknown content attributes, however is there any general
guidelines for reflecting (or not) unknown content attributes in the
DOM, or is that left to the UA's discretion?

 

---

<body onload="check()">

 <a href="foo.html" myExpando="bar">

 <script type=text/javascript>

 function check()

 {

                var anchor = document.getElementsByTagName('a').item(0);

                                

                alert("Is a reflecting DOM attribute dynamically
created? (case-insensitive) anchor.myexpando {" + anchor.myexpando +
"}\n" +

                      "Is a reflecting DOM attribute dynamically
created? (case-sensitive) anchor.myExpando {" + anchor.myExpando + "}\n"
+

                      "Is a content attribute created?
(case-insensitive) anchor.getAttribute('myexpando') {" +
anchor.getAttribute('myexpando') + "}\n" +

                      "Is a content attribute created? (case-sensitive)
anchor.getAttribute('myExpando') {" + anchor.getAttribute('myExpando') +
"}");

                

                // Setting the anchor.myExpando reflects in the 

// content attribute, and removing the content 

// attribute removes the DOM attribute.

 }

 </script>
Received on Friday, 22 June 2007 18:04:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:45 UTC