This was reduced from aeroplan.com when trying to book a flight. This may not be the only problem, but it is rather major so I had to hack around it manually. This function doesn't seem to work in KHTML the way the site expects it to: function interrogate(what) { for(var i in what) { if (i == "length") { return true; } } return false; } when called with a radio button group from a form. Testcase attached.
Created attachment 9120 [details] Testcase
Confirmed that this works with IE6.
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;