JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName) { JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase)); HTMLDocument* document = thisObj->impl(); AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName); if (!atomicPropertyName || !document->hasDocumentNamedItem(atomicPropertyName)) return jsUndefined(); if (UNLIKELY(document->documentNamedItemContainsMultipleElements(atomicPropertyName))) { RefPtr<HTMLCollection> collection = document->documentNamedItems(atomicPropertyName); ASSERT(!collection->isEmpty()); ASSERT(!collection->hasExactlyOneItem()); return toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)); } Node* node = document->documentNamedItem(atomicPropertyName); Frame* frame; if (node->hasTagName(iframeTag) && (frame = toHTMLIFrameElement(node)->contentFrame())) return toJS(exec, frame); return toJS(exec, thisObj->globalObject(), node); }