473,836 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOM 2 Attributes (NamedNodeMap)

Hello,

According to DOM 2 Core, the attribute "nodeRef.attrib utes" 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 1658
Gérard Talbot wrote:
Hello,

According to DOM 2 Core, the attribute "nodeRef.attrib utes" 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
1456
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 = plist.attributes attribs.keys()
50
6396
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 def foo(self, data): self.attr1=data self.attr2.append(data) The initialization of attr1 is obviously OK, all instances of Father redefine it in the method foo. But the initialization of attr2 is wrong
1
2726
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 namespace prefix, what is its namespace, if default namespaces do not apply? Are (either of) prefixed or non-prefixed attributes correct? For example, are the following equivalent: <html:br class="foo"...
9
1845
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 owner element. Is that right ? Like:
7
1852
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
12265
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 these file attributes.
7
4550
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" MS_POSITIONING="GridLayout" class="Body" runat="server"> And in my code-behind I want to look for the leftMargin
2
2535
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 is the usage of "Custom Attribute" in real life project. Can somebody please help me understand where are these informations really helpful in Development Environment; may be a few example(s) will help me understand.
2
6602
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' attr2='somevalue' attrN='...'>markup</span>" 3 Dim objSpan As HTMLSpanElement = browser.Document.createElement("span") 4 objSpan.innerHTML = strMarkup
0
9671
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10852
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10255
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9382
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4021
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.