473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DOM 2 Attributes (NamedNodeMap)

Hello,

According to DOM 2 Core, the attribute "nodeRef.attributes" is
"A NamedNodeMap containing the attributes of this node (if it is an
Element) or null otherwise."
http://www.w3.org/TR/2000/REC-DOM-Le...tml#ID-84CF096

The question I have is if such NamedNodeMap contains the specified
attributes or all possible/actual/specified attributes. This question is
important because MSIE 6 will return all possible attributes while other
browsers will report only actual attributes, those which are specified.

Which browser is right?

Peter-Paul Koch thinks
http://www.quirksmode.org/dom/w3c_core.html#link8
that the list of actual/specified attributes is "decidedly the saner
interpretation." of the spec.

I thought he was right until I examined the DOM spec. If the returned
list should be about the specified/actual attributes only, then why is
it that the W3C needed to define an another attribute for the attribute
object, namely the specified attribute?

http://www.w3.org/TR/2000/REC-DOM-Le...l#ID-862529273

I'm confused and not sure what to think.

Gérard
--
remove blah to email me
Feb 21 '06 #1
1 1619
Gérard Talbot wrote:
Hello,

According to DOM 2 Core, the attribute "nodeRef.attributes" is
"A NamedNodeMap containing the attributes of this node (if it is an
Element) or null otherwise."
http://www.w3.org/TR/2000/REC-DOM-Le...tml#ID-84CF096
The question I have is if such NamedNodeMap contains the specified
attributes or all possible/actual/specified attributes. This question is
important because MSIE 6 will return all possible attributes while other
browsers will report only actual attributes, those which are specified.

Which browser is right?

Peter-Paul Koch thinks
http://www.quirksmode.org/dom/w3c_core.html#link8
that the list of actual/specified attributes is "decidedly the saner
interpretation." of the spec.

I thought he was right until I examined the DOM spec. If the returned
list should be about the specified/actual attributes only, then why is
it that the W3C needed to define an another attribute for the attribute
object, namely the specified attribute?

ISTM that the purpose of the specified attribute is to tell you whether
the attribute has been modified by the user or not. If it has (even if
it is set back to the default) the specified attribute will be 'false'.

Some references: W3C on interface Attr:

"The attribute's effective value is determined as follows: if this
attribute has been explicitly assigned any value, that value is the
attribute's effective value; otherwise, if there is a declaration
for this attribute, and that declaration includes a default value,
then that default value is the attribute's effective value;
otherwise, the attribute does not exist on this element in the
structure model until it has been explicitly added."

<URL:http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-637646024>
Which seems consistent with only giving the attributes object references
to properties that have been given values rather than to every possible
attribute for the element.

On interface Attr's specified attribute:

"If this attribute was explicitly given a value in the original
document, this is true; otherwise, it is false..."

<URL:http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-862529273>


--
Rob
Feb 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ajay | last post by:
hi! i am trying to print the keys of a NamedNodeMap which contains the attributes of a element. for the element, <DATA ref="#business.name">CatalogExample</DATA> i expect attribs =...
50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
9
by: Soren Kuula | last post by:
Hi, I just can't find namespaces of attributes stated clearly enough in the XML namespace spec. But .. I hear rumors that attributes, unless qualified otherwise, default to the namespace of the...
7
by: Info 3000 | last post by:
Hello, I'm beginner in XML. I have just a little question : I understand that I can write : <Book> <Title> A nice day </Title> <Author> James Nicepen </Author> </Book>
7
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for...
7
by: localhost | last post by:
What is the best and/or fastest way to enumerate attributes of an HTML control? In my page template, I have: <body id="myBody" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"...
2
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. The only thing I did not understand in this article...
2
by: cloftis | last post by:
Using VS2003, VB and MSHTML, Using an HTMLSpanElement I want to enumerate the attributes of a SPAN tag. 1 'For testing sake 2 Dim strMarkup as String = "<span attr1='somevalue'...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.