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

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: Now avoids hitting assert. 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
« no previous file with comments | « Source/core/dom/CustomElementRegistry.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/dom/CustomElementRegistry.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698