[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: DOM node are 'live'
Hi, I'm not sure if other implementers dealt with this issue already, but we recently did, and the spec should really be clarified. The issue has to do with the nodes being 'live' or not. The DOM level 3 specification clearly specifies that DOM nodes are live: "The DOM also specifies a NodeList interface to handle ordered lists of Nodes, such as the children of a Node, or the elements returned by the Element.getElementsByTagNameNS(namespaceURI, localName) method, and also a NamedNodeMap interface to handle unordered sets of nodes referenced by their name attribute, such as the attributes of an Element. NodeList and NamedNodeMap objects in the DOM are live; that is, changes to the underlying document structure are reflected in all relevant NodeList and NamedNodeMap objects. For example, if a DOM user gets a NodeList object containing the children of an Element, then subsequently adds more children to that element (or removes children, or modifies them), those changes are automatically reflected in the NodeList, without further action on the user's part. Likewise, changes to a Node in the tree are reflected in all references to that Node in NodeList and NamedNodeMap objects." The wording in our specification is not that clear, but I think it should be. On a related matter... I earlier proposed that WebCGMStringList be added a clear() method and that WebCGMNodeList have the same. Based on implementation feedback, I made a mistake. Sorry. It is fine for WebCGMStringList to have a clear() method, but not for WebCGMNodeList. Instead, the removeItem method should be used to clear a node list. Here's why: var aps = cgmPic.getAppStructureById("_1"); // returns an APS var a = aps1.attributes; // returns a node list var i = a.item(0); // return a attr node a.clear(); // a is empty and aps1 doesn't have any attributes // what's the state of i? The method removeItem returns the deleted node, so it is still accessible: WebCGMNode removeItem ( in unsigned long index ). The same is not applicable for clear(). WebCGMStringLists do not contain interface pointers and are therefore not live, the problem is not existent in this case. Thoughts? I'm willing to take one action item: 1) To propose wording with regards to DOM nodes being live. Could Lofton take one: 2) To remove the clear() method on WebCGMNodeList. -- Benoit mailto:benoit@itedo.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]