W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

removeNamedItem vs removeAttribute

From: Daniel Lobo Veiga <dveiga@inescporto.pt>
Date: Mon, 5 Feb 2001 19:08:55 -0000
Message-ID: <004001c08fa7$163ef8f0$8f1875c2@emperor>
To: "DOM" <www-dom@w3.org>
The removeNamedItem ( in DOMString name ) method of the NamedNodeMap interface says this:
"Removes a node specified by name. When this map
contains the attributes attached to an element ..." 
It takes the nodeName of the node to remove as parameter, and returns the node removed from the map if a node with that name exists. This method can raise the following exceptions:
"NOT_FOUND_ERR: Raised if there is no node named
name in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly."

In the Element interface it is defined the removeAttribute ( in DOMString name ) method that says:
"Removes an attribute by name..."
It takes the name of the attribute to remove as parameter and it doesn't return anything. The method can raise the following exception:
"NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly."

From the stated above I think one can use any of two methods to remove an attribute that is attached to an element. The two methods take the same argument (the nodeName), so shouldn't they have the same return value? What happens if there is no attribute with a name equal to the argument of the removeAttribute method? Shouldn't be raised a NOT_FOUND_ERR exception as for the removeNamedItem case?   

 Daniel Lobo Veiga 
 INESC Porto 
 Pç República 93 R/C  4050-497 Porto, Portugal                
 Tel: +351 22 2094223                             
 Email: dveiga@inescporto.pt   
Received on Monday, 5 February 2001 14:11:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC