Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Attr and NamedNodeMap in DOM4 are inconsistent #4

Closed
walroy opened this issue Mar 2, 2016 · 2 comments
Closed

Attr and NamedNodeMap in DOM4 are inconsistent #4

walroy opened this issue Mar 2, 2016 · 2 comments
Assignees
Milestone

Comments

@walroy
Copy link

walroy commented Mar 2, 2016

The DOM4 specification dated 19 November 2015 (see https://www.w3.org/TR/dom/), in section 4.8, lists interfaces for Element and Attr.

The Element interface defines the attribute "[SameObject] readonly attribute NamedNodeMap attributes;
". Notice that this is of type NamedNodeMap. The DOM4 has no definition of NamedNodeMap interface. Neither is there any indication in the text where it is defined. However, in the Element interface the reference to NamedNodeMap is linked to a DOM Level 3 Core.

DOM3 Level 3 Core details the NamedNodeMap interface. The text describes the NamedNodeMap interface as representing collections of Nodes, where Node is as defined in DOM Level 3 Core.

Now, let's return to DOM4. This time consider the Attr interface. Where is it used? The answer is nowhere. There are six instances in the specification where "Attr" appears. The last instance, in section 8.2, clearly shows that the Attr interface no longer inherits from Node.

Section 4.8 is not entirely clear as to whether the "attributes" part of the interface are instantiated using the "Attr" interface. While the descriptive text implies it, the interfaces rule it out.

All becomes clearer when referring to the WhatWG specification. Here, the NamedNodeMap interface is redefined in terms of the Attr interface.

Evidently the DOM4 specification has been passed as a recommendation when changes have only been partly applied. Thus, the DOM4 specification, as currently written, is sadly, unsuitable for normatively referencing in other specifications as it is effectively unimplementable. This situation needs urgent corrective action.

@plehegar plehegar added the bug label Mar 2, 2016
@powerwaremediacore
Copy link

In DOM3 NamedNodeMap is a collection of Nodes. In DOM4 Attr interface in no longer a Node dependant. Then NamedNodeMap can't be used to hold Attr objects, because it is incompatible.

@yongsheng
Copy link
Collaborator

We'll make Attr inherits from Interface Node in 4.1. Any comments?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants