[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kdom
From:       Rob Buis <rwlbuis () xs4all ! nl>
Date:       2004-04-19 19:03:58
Message-ID: 20040419190358.4B01C9955 () office ! kde ! org
[Download RAW message or body]

CVS commit by buis: 


Fix for hc_notationssetnameditemns1.svg.


  M +19 -1     NamedNodeMap.cc   1.22
  M +2 -0      NamedNodeMap.h   1.10


--- kdenonbeta/kdom/NamedNodeMap.h  #1.9:1.10
@@ -40,4 +40,6 @@ namespace KDOM
                 bool operator!=(const NamedNodeMap &other) const;
 
+                virtual bool isReadOnly() const { return true; }
+
                 // 'NamedNodeMap' functions
                 virtual Node &getNamedItem(const DOMString &name) const;

--- kdenonbeta/kdom/NamedNodeMap.cc  #1.21:1.22
@@ -107,5 +107,5 @@ Value NamedNodeMapProtoFunc::call(ExecSt
                 {
                         Node &n = ecma_cast<Node>(args[0], &toNode);
-                        return getDOMNode(exec, obj->setNamedItem(n));
+                        return getDOMNode(exec, obj->setNamedItemNS(n));
                 }
                 case NamedNodeMapConstants::RemoveNamedItemNS:
@@ -180,4 +180,13 @@ Node &NamedNodeMap::getNamedItem(const D
 Node &NamedNodeMap::setNamedItem(const Node &arg)
 {
+        // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
+        if(isReadOnly())
+                throw new DOMException(NO_MODIFICATION_ALLOWED_ERR);
+
+        // Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap.
+        // TODO : differentiate between these two types
+        if(arg.nodeType() != ENTITY_NODE && arg.nodeType() != NOTATION_NODE)
+                throw new DOMException(HIERARCHY_REQUEST_ERR);
+
         if(arg == Node::null || !d)
                 return Node::null;
@@ -244,4 +253,13 @@ Node &NamedNodeMap::getNamedItemNS(const
 Node &NamedNodeMap::setNamedItemNS(const Node &arg)
 {
+        // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
+        if(isReadOnly())
+                throw new DOMException(NO_MODIFICATION_ALLOWED_ERR);
+
+        // Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap.
+        // TODO : differentiate between these two types
+        if(arg.nodeType() != ENTITY_NODE && arg.nodeType() != NOTATION_NODE)
+                throw new DOMException(HIERARCHY_REQUEST_ERR);
+
         if(arg == Node::null || !d)
                 return Node::null;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic