Index: Source/core/html/WindowNameCollection.cpp |
diff --git a/Source/core/html/WindowNameCollection.cpp b/Source/core/html/WindowNameCollection.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7321f853f292cc426b718476b70af09862d436a3 |
--- /dev/null |
+++ b/Source/core/html/WindowNameCollection.cpp |
@@ -0,0 +1,32 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "core/html/WindowNameCollection.h" |
+ |
+#include "core/html/HTMLImageElement.h" |
+ |
+namespace WebCore { |
+ |
+WindowNameCollection::WindowNameCollection(ContainerNode& document, const AtomicString& name) |
+ : HTMLNameCollection(document, WindowNamedItems, name) |
+{ |
+} |
+ |
+bool WindowNameCollection::elementMatches(const Element& element) const |
+{ |
+ // Match only images, forms, applets, embeds and objects by name, |
+ // but anything by id |
+ if (isHTMLImageElement(element) |
+ || isHTMLFormElement(element) |
+ || isHTMLAppletElement(element) |
+ || isHTMLEmbedElement(element) |
+ || isHTMLObjectElement(element)) { |
+ if (element.getNameAttribute() == m_name) |
+ return true; |
+ } |
+ return element.getIdAttribute() == m_name; |
+} |
+ |
+} // namespace WebCore |