OLD | NEW |
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/CustomElementDefinition.h" | 5 #include "core/dom/custom/CustomElementDefinition.h" |
6 | 6 |
7 #include "core/dom/Attr.h" | 7 #include "core/dom/Attr.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/dom/custom/CustomElement.h" | 9 #include "core/dom/custom/CustomElement.h" |
10 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" | 10 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // 6.1.4. If result's attribute list is not empty, then throw a NotSupported
Error. | 45 // 6.1.4. If result's attribute list is not empty, then throw a NotSupported
Error. |
46 if (element->hasAttributes()) | 46 if (element->hasAttributes()) |
47 return "The result must not have attributes"; | 47 return "The result must not have attributes"; |
48 // 6.1.5. If result has children, then throw a NotSupportedError. | 48 // 6.1.5. If result has children, then throw a NotSupportedError. |
49 if (element->hasChildren()) | 49 if (element->hasChildren()) |
50 return "The result must not have children"; | 50 return "The result must not have children"; |
51 // 6.1.6. If result's parent is not null, then throw a NotSupportedError. | 51 // 6.1.6. If result's parent is not null, then throw a NotSupportedError. |
52 if (element->parentNode()) | 52 if (element->parentNode()) |
53 return "The result must not have a parent"; | 53 return "The result must not have a parent"; |
54 // 6.1.7. If result's node document is not document, then throw a NotSupport
edError. | 54 // 6.1.7. If result's node document is not document, then throw a NotSupport
edError. |
55 if (&element->document() != &document) | 55 if (&element->document() != &document |
| 56 && element->document().contextDocument() != document.contextDocument())
{ |
56 return "The result must be in the same document"; | 57 return "The result must be in the same document"; |
| 58 } |
57 // 6.1.8. If result's namespace is not the HTML namespace, then throw a NotS
upportedError. | 59 // 6.1.8. If result's namespace is not the HTML namespace, then throw a NotS
upportedError. |
58 if (element->namespaceURI() != HTMLNames::xhtmlNamespaceURI) | 60 if (element->namespaceURI() != HTMLNames::xhtmlNamespaceURI) |
59 return "The result must have HTML namespace"; | 61 return "The result must have HTML namespace"; |
60 // 6.1.9. If result's local name is not equal to localName, then throw a Not
SupportedError. | 62 // 6.1.9. If result's local name is not equal to localName, then throw a Not
SupportedError. |
61 if (element->localName() != tagName.localName()) | 63 if (element->localName() != tagName.localName()) |
62 return "The result must have the same localName"; | 64 return "The result must have the same localName"; |
63 return String(); | 65 return String(); |
64 } | 66 } |
65 | 67 |
66 void CustomElementDefinition::checkConstructorResult(Element* element, | 68 void CustomElementDefinition::checkConstructorResult(Element* element, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 element->synchronizeAttribute(name); | 171 element->synchronizeAttribute(name); |
170 for (const auto& attribute : element->attributesWithoutUpdate()) { | 172 for (const auto& attribute : element->attributesWithoutUpdate()) { |
171 if (hasAttributeChangedCallback(attribute.name())) { | 173 if (hasAttributeChangedCallback(attribute.name())) { |
172 enqueueAttributeChangedCallback(element, attribute.name(), | 174 enqueueAttributeChangedCallback(element, attribute.name(), |
173 nullAtom, attribute.value()); | 175 nullAtom, attribute.value()); |
174 } | 176 } |
175 } | 177 } |
176 } | 178 } |
177 | 179 |
178 } // namespace blink | 180 } // namespace blink |
OLD | NEW |