| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ASSERT(!type.isEmpty()); | 127 ASSERT(!type.isEmpty()); |
| 128 element->setAttribute(HTMLNames::isAttr, type); | 128 element->setAttribute(HTMLNames::isAttr, type); |
| 129 setTypeExtension(element, type); | 129 setTypeExtension(element, type); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CustomElementRegistrationContext::setTypeExtension(Element* element, const
AtomicString& type) | 132 void CustomElementRegistrationContext::setTypeExtension(Element* element, const
AtomicString& type) |
| 133 { | 133 { |
| 134 if (!element->isHTMLElement() && !element->isSVGElement()) | 134 if (!element->isHTMLElement() && !element->isSVGElement()) |
| 135 return; | 135 return; |
| 136 | 136 |
| 137 if (CustomElement::isCustomTagName(element->localName())) | 137 if (element->isCustomElement()) { |
| 138 return; // custom tags take precedence over type extensions | 138 // This can happen if: |
| 139 // 1. The element has a custom tag, which takes precedence over |
| 140 // type extensions. |
| 141 // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an |
| 142 // element but tries to overwrite its attribute list. |
| 143 return; |
| 144 } |
| 145 |
| 146 // Custom tags take precedence over type extensions |
| 147 ASSERT(!CustomElement::isCustomTagName(element->localName())); |
| 139 | 148 |
| 140 if (CustomElementRegistrationContext* context = element->document()->registr
ationContext()) | 149 if (CustomElementRegistrationContext* context = element->document()->registr
ationContext()) |
| 141 context->didGiveTypeExtension(element, type); | 150 context->didGiveTypeExtension(element, type); |
| 142 } | 151 } |
| 143 | 152 |
| 144 } // namespace WebCore | 153 } // namespace WebCore |
| OLD | NEW |