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

List:       kde-commits
Subject:    kdelibs/khtml/ecma
From:       David Faure <faure () kde ! org>
Date:       2005-01-17 20:23:48
Message-ID: 20050117202348.AC02D1CF39 () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

DOMNamedNodesCollection: fixed 'length' not available during enumerating, like "for \
                (var i in what)"
BUG: 97185


  M +12 -8     kjs_dom.cpp   1.183
  M +2 -1      kjs_dom.h   1.73


--- kdelibs/khtml/ecma/kjs_dom.cpp  #1.182:1.183
@@ -1211,4 +1211,7 @@ Value DOMDocumentType::getValueProperty(
   removeNamedItemNS     DOMNamedNodeMap::RemoveNamedItemNS      DontDelete|Function \
2  @end
+@begin DOMNamedNodeMapTable 7
+  length                DOMNamedNodeMap::Length                 DontDelete|Function \
1 +@end
 */
 DEFINE_PROTOTYPE("NamedNodeMap", DOMNamedNodeMapProto)
@@ -1216,5 +1219,5 @@ IMPLEMENT_PROTOFUNC_DOM(DOMNamedNodeMapP
 IMPLEMENT_PROTOTYPE(DOMNamedNodeMapProto,DOMNamedNodeMapProtoFunc)
 
-const ClassInfo DOMNamedNodeMap::info = { "NamedNodeMap", 0, 0, 0 };
+const ClassInfo DOMNamedNodeMap::info = { "NamedNodeMap", 0, &DOMNamedNodeMapTable, \
0 };  
 DOMNamedNodeMap::DOMNamedNodeMap(ExecState *exec, const DOM::NamedNodeMap& m)
@@ -1226,10 +1229,6 @@ DOMNamedNodeMap::~DOMNamedNodeMap()
 }
 
-// We have to implement hasProperty since we don't use a hashtable for 'length'
-// ## this breaks "for (..in..)" though.
 bool DOMNamedNodeMap::hasProperty(ExecState *exec, const Identifier &p) const
 {
-  if (p == lengthPropertyName)
-    return true;
   // ## missing? array index
   return DOMObject::hasProperty(exec, p);
@@ -1620,5 +1619,10 @@ Object KJS::getDOMExceptionConstructor(E
 // -------------------------------------------------------------------------
 
-const ClassInfo KJS::DOMNamedNodesCollection::info = { "DOMNamedNodesCollection", 0, \
0, 0 }; +/* Source for DOMNamedNodesCollection.
+@begin DOMNamedNodesCollectionTable 1
+  length                KJS::DOMNamedNodesCollection::Length            \
DontDelete|ReadOnly +@end
+*/
+const ClassInfo KJS::DOMNamedNodesCollection::info = { "DOMNamedNodesCollection", 0, \
&DOMNamedNodesCollectionTable, 0 };  
 // Such a collection is usually very short-lived, it only exists

--- kdelibs/khtml/ecma/kjs_dom.h  #1.72:1.73
@@ -182,5 +182,5 @@ namespace KJS {
     virtual bool toBoolean(ExecState *) const { return true; }
     static const ClassInfo info;
-    enum { GetNamedItem, SetNamedItem, RemoveNamedItem, Item,
+    enum { GetNamedItem, SetNamedItem, RemoveNamedItem, Item, Length,
            GetNamedItemNS, SetNamedItemNS, RemoveNamedItemNS };
     DOM::NamedNodeMap toMap() const { return map; }
@@ -261,4 +261,5 @@ namespace KJS {
     static const ClassInfo info;
     const QValueList<DOM::Node>& nodes() const { return m_nodes; }
+    enum { Length };
   private:
     QValueList<DOM::Node> m_nodes;


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

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