Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
| index 0e703cad458ebf76c73dec97eca5604fcd7284f7..7ad996976d8534e102382e6414c79df8bf952aca 100644 |
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
| @@ -194,16 +194,22 @@ ScriptValue CustomElementRegistry::get(const AtomicString& name) { |
| return definition->getConstructorForScript(); |
| } |
| +// https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-element-definition |
| +// At this point, what the spec calls 'is' is 'name' from desc |
| CustomElementDefinition* CustomElementRegistry::definitionFor( |
| const CustomElementDescriptor& desc) const { |
| - CustomElementDefinition* definition = definitionForName(desc.name()); |
| - if (!definition) |
| - return nullptr; |
| - // The definition for a customized built-in element, such as |
| - // <button is="my-button"> should not be provided for an |
| - // autonomous element, such as <my-button>, even though the |
| - // name "my-button" matches. |
| - return definition->descriptor() == desc ? definition : nullptr; |
| + // 4. If there is a definition in registry with name equal to localName and |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
Try to write this with only one lookup with defini
|
| + // local name equal to localName, return that definition |
| + CustomElementDefinition* definition = definitionForName(desc.localName()); |
| + if (definition and definition->descriptor().localName() == desc.localName()) |
| + return definition; |
| + // 5. If there is a definition in registry with name equal to is and local |
| + // name equal to localName, return that definition |
| + definition = definitionForName(desc.name()); |
| + if (definition and definition->descriptor().localName() == desc.localName()) |
| + return definition; |
| + // 6. Return null |
| + return nullptr; |
| } |
| bool CustomElementRegistry::nameIsDefined(const AtomicString& name) const { |