<rdar://problem/
3907705> REGRESSION (172-173): DHTML menus are broken at hrweb.apple.com
* khtml/dom/html_document.cpp:
(HTMLDocument::nameableItems): New method, wrapper for HTMLCollection creation.
* khtml/dom/html_document.h:
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLDocument::tryGet): use doc.nameableItems(), not doc.all()!
* khtml/html/html_miscimpl.cpp:
(HTMLCollectionImpl::traverseNextItem): Added new DOC_NAMEABLE_ITEMS type, this represents
the items that can be accessed directly as a document propery, in particular forms, images,
objects, applets and embeds.
(HTMLCollectionImpl::updateNameCache): Fix some nameCache/idCache confusion.
(HTMLFormCollectionImpl::updateNameCache): Ditto.
* khtml/html/html_miscimpl.h:
(DOM::HTMLCollectionImpl::): Added new type.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8185
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-12-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ <rdar://problem/3907705> REGRESSION (172-173): DHTML menus are broken at hrweb.apple.com
+
+ * khtml/dom/html_document.cpp:
+ (HTMLDocument::nameableItems): New method, wrapper for HTMLCollection creation.
+ * khtml/dom/html_document.h:
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLDocument::tryGet): use doc.nameableItems(), not doc.all()!
+ * khtml/html/html_miscimpl.cpp:
+ (HTMLCollectionImpl::traverseNextItem): Added new DOC_NAMEABLE_ITEMS type, this represents
+ the items that can be accessed directly as a document propery, in particular forms, images,
+ objects, applets and embeds.
+ (HTMLCollectionImpl::updateNameCache): Fix some nameCache/idCache confusion.
+ (HTMLFormCollectionImpl::updateNameCache): Ditto.
+ * khtml/html/html_miscimpl.h:
+ (DOM::HTMLCollectionImpl::): Added new type.
+
2004-12-10 Ken Kocienda <kocienda@apple.com>
Reviewed by John
return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL);
}
+HTMLCollection HTMLDocument::nameableItems() const
+{
+ if(!impl) return HTMLCollection();
+ return HTMLCollection(impl, HTMLCollectionImpl::DOC_NAMEABLE_ITEMS);
+}
+
DOMString HTMLDocument::cookie() const
{
if (!impl) return DOMString();
*/
HTMLCollection all() const;
+ /**
+ * Not part of the DOM
+ *
+ * A collection of all the <code>IMG</code>, <code>OBJECT</code>,
+ * <code>EMBED</code>, <code>APPLET</code>, and <code>FORM</code> tags in
+ * a document. Used when looking up elements by name as properties on the document
+ * object, e.g. document.myForm for a form with name attribute of "myForm".
+ */
+ HTMLCollection nameableItems() const;
};
}; //namespace
return Undefined();
}
- DOM::HTMLCollection collAll = doc.all();
- KJS::HTMLCollection htmlcoll(exec,collAll);
- return htmlcoll.getNamedItems(exec, propertyName); // Get all the items with the same name
+ DOM::HTMLCollection nameableItems = doc.nameableItems();
+ KJS::HTMLCollection kjsCollection(exec,nameableItems);
+ return kjsCollection.getNamedItems(exec, propertyName); // Get all the items with the same name
return Undefined();
}
if(e->id() == ID_FORM)
found = true;
break;
+ case DOC_NAMEABLE_ITEMS:
+ if(e->id() == ID_IMG)
+ found = true;
+ if(e->id() == ID_FORM)
+ found = true;
+ if(e->id() == ID_APPLET)
+ found = true;
+ if(e->id() == ID_EMBED)
+ found = true;
+ if(e->id() == ID_OBJECT)
+ found = true;
+ break;
case TABLE_TBODIES:
if(e->id() == ID_TBODY)
found = true;
e->id() == ID_APPLET || e->id() == ID_OBJECT ||
e->id() == ID_EMBED))) {
// add to name cache
- QPtrVector<NodeImpl> *nameVector = info->idCache.find(nameAttr);
+ QPtrVector<NodeImpl> *nameVector = info->nameCache.find(nameAttr);
if (!nameVector) {
nameVector = new QPtrVector<NodeImpl>;
info->nameCache.insert(nameAttr, nameVector);
}
if (!nameAttr.isEmpty() && idAttr != nameAttr && !foundInputElements.find(nameAttr)) {
// add to name cache
- QPtrVector<NodeImpl> *nameVector = info->idCache.find(nameAttr);
+ QPtrVector<NodeImpl> *nameVector = info->nameCache.find(nameAttr);
if (!nameVector) {
nameVector = new QPtrVector<NodeImpl>;
info->nameCache.insert(nameAttr, nameVector);
MAP_AREAS,
DOC_ALL, // "all" elements (IE)
NODE_CHILDREN, // first-level children (IE)
+ DOC_NAMEABLE_ITEMS, // all IMG, FORM, APPLET, EMBED and OBJECT elements, used to look
+ // up element name as document property
LAST_TYPE
};