Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Unified Diff: Source/core/dom/CustomElementRegistry.cpp

Issue 14834002: Set a bit on Custom Elements on creation to simplify wrapping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/CustomElementRegistry.cpp
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
index 9efd199c2dc77dd0c388524bdcef41eddf65a3d6..832c76191bab81de554f9045c19ac68db5a41b4a 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();
}
@@ -224,6 +223,8 @@ PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const Qualifie
else
element = Element::create(tagName, document());
+ element->setIsCustomElement();
+
RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(tagName.localName(), tagName.namespaceURI());
if (definition && !definition->isTypeExtension())
didCreateCustomTagElement(element.get());
@@ -233,6 +234,7 @@ PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const Qualifie
void CustomElementRegistry::didGiveTypeExtension(Element* element)
{
+ element->setIsCustomElement();
RefPtr<CustomElementDefinition> definition = findFor(element);
if (!definition || !definition->isTypeExtension())
return;

Powered by Google App Engine
This is Rietveld 408576698