| Index: third_party/WebKit/Source/core/dom/query/SelectorTagMatcher.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/query/SelectorTagMatcher.cpp b/third_party/WebKit/Source/core/dom/query/SelectorTagMatcher.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e8b645b2d56cb0b217b8446dcaa4663c5cac0852
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/dom/query/SelectorTagMatcher.cpp
|
| @@ -0,0 +1,36 @@
|
| +// Copyright 2015 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/dom/query/SelectorTagMatcher.h"
|
| +
|
| +#include "core/dom/ContainerNode.h"
|
| +#include "core/dom/Element.h"
|
| +
|
| +namespace blink {
|
| +
|
| +SelectorTagMatcher::SelectorTagMatcher(const QualifiedName& tagName)
|
| + : m_tagName(tagName)
|
| +{
|
| + ASSERT(m_tagName != anyQName());
|
| +}
|
| +
|
| +SelectorTagMatcher::~SelectorTagMatcher()
|
| +{
|
| +}
|
| +
|
| +bool SelectorTagMatcher::match(Element& element, ContainerNode& rootNode) const
|
| +{
|
| + if (element.hasLocalName(m_tagName.localName()))
|
| + return true;
|
| + // Non-html elements in html documents are normalized to their camel-cased
|
| + // version during parsing if applicable. Yet, type selectors are lower-cased
|
| + // for selectors in html documents. Compare the upper case converted names
|
| + // instead to allow matching SVG elements like foreignObject.
|
| + if (!element.isHTMLElement() && element.document().isHTMLDocument())
|
| + return element.tagQName().localNameUpper() == m_tagName.localNameUpper();
|
| + return false;
|
| +}
|
| +
|
| +}
|
|
|