Index: Source/core/dom/CustomElementRegistry.cpp |
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp |
index 9efd199c2dc77dd0c388524bdcef41eddf65a3d6..61c422fb4fffc1795d6c1f73c1401ceb13db8437 100644 |
--- a/Source/core/dom/CustomElementRegistry.cpp |
+++ b/Source/core/dom/CustomElementRegistry.cpp |
@@ -174,13 +174,12 @@ PassRefPtr<CustomElementDefinition> CustomElementRegistry::findFor(Element* elem |
{ |
ASSERT(element->document()->registry() == this); |
- // Most elements can be rejected with this quick screening. |
- if (!nameIncludesHyphen(element->tagName()) && !element->hasAttribute(HTMLNames::isAttr)) |
+ if (!element->isCustomElement()) |
return 0; |
// When a custom tag and a type extension are provided as element |
// names at the same time, the custom tag takes precedence. |
- if (isValidName(element->localName())) { |
+ if (isCustomTagName(element->localName())) { |
if (RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(element->localName(), element->namespaceURI())) |
return definition->isTypeExtension() ? 0 : definition.release(); |
} |
@@ -222,7 +221,9 @@ PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const Qualifie |
element = SVGElement::create(tagName, document()); |
#endif |
else |
- element = Element::create(tagName, document()); |
+ return Element::create(tagName, document()); |
+ |
+ element->setIsCustomElement(); |
RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(tagName.localName(), tagName.namespaceURI()); |
if (definition && !definition->isTypeExtension()) |
@@ -233,6 +234,9 @@ PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const Qualifie |
void CustomElementRegistry::didGiveTypeExtension(Element* element) |
{ |
+ if (!element->isHTMLElement() && !element->isSVGElement()) |
+ return; |
+ element->setIsCustomElement(); |
RefPtr<CustomElementDefinition> definition = findFor(element); |
if (!definition || !definition->isTypeExtension()) |
return; |