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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp

Issue 2502223002: Custom Elements: The 'is' Attribute Should Not Be Specified on an Autonomous Custom Element (Closed)
Patch Set: edits made to follow specs more closely Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/custom/CustomElementRegistry.h" 5 #include "core/dom/custom/CustomElementRegistry.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // e.g. |undefined| for v8. 207 // e.g. |undefined| for v8.
208 return ScriptValue(); 208 return ScriptValue();
209 } 209 }
210 return definition->getConstructorForScript(); 210 return definition->getConstructorForScript();
211 } 211 }
212 212
213 // https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-elemen t-definition 213 // https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-elemen t-definition
214 // At this point, what the spec calls 'is' is 'name' from desc 214 // At this point, what the spec calls 'is' is 'name' from desc
215 CustomElementDefinition* CustomElementRegistry::definitionFor( 215 CustomElementDefinition* CustomElementRegistry::definitionFor(
216 const CustomElementDescriptor& desc) const { 216 const CustomElementDescriptor& desc) const {
217 // 4&5. If there is a definition in registry with name equal to is/localName 217 // desc.name() is 'is' attribute
218 // Autonomous elements have the same name and local name 218 // 4. If definition in registry with name equal to local name...
219 CustomElementDefinition* definition = definitionForName(desc.name()); 219 CustomElementDefinition* definition = definitionForName(desc.localName());
220 // 4&5. and name equal to localName, return that definition 220 // 5. If definition in registry with name equal to name...
221 if (definition and definition->descriptor().localName() == desc.localName()) 221 if (!definition)
222 definition = definitionForName(desc.name());
223 // 4&5. ...and local name equal to localName, return that definition
224 if (definition and definition->descriptor().localName() == desc.localName()) {
222 return definition; 225 return definition;
226 }
223 // 6. Return null 227 // 6. Return null
224 return nullptr; 228 return nullptr;
225 } 229 }
226 230
227 bool CustomElementRegistry::nameIsDefined(const AtomicString& name) const { 231 bool CustomElementRegistry::nameIsDefined(const AtomicString& name) const {
228 return m_definitions.contains(name); 232 return m_definitions.contains(name);
229 } 233 }
230 234
231 void CustomElementRegistry::entangle(V0CustomElementRegistrationContext* v0) { 235 void CustomElementRegistry::entangle(V0CustomElementRegistrationContext* v0) {
232 m_v0->add(v0); 236 m_v0->add(v0);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 m_upgradeCandidates->remove(it); 300 m_upgradeCandidates->remove(it);
297 301
298 Document* document = m_owner->document(); 302 Document* document = m_owner->document();
299 if (!document) 303 if (!document)
300 return; 304 return;
301 305
302 sorter.sorted(elements, document); 306 sorter.sorted(elements, document);
303 } 307 }
304 308
305 } // namespace blink 309 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698