| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ASSERT(!type.isEmpty()); | 156 ASSERT(!type.isEmpty()); |
| 157 element->setAttribute(HTMLNames::isAttr, type); | 157 element->setAttribute(HTMLNames::isAttr, type); |
| 158 setTypeExtension(element, type); | 158 setTypeExtension(element, type); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void CustomElementRegistrationContext::setTypeExtension(Element* element, const
AtomicString& type) | 161 void CustomElementRegistrationContext::setTypeExtension(Element* element, const
AtomicString& type) |
| 162 { | 162 { |
| 163 if (!element->isHTMLElement() && !element->isSVGElement()) | 163 if (!element->isHTMLElement() && !element->isSVGElement()) |
| 164 return; | 164 return; |
| 165 | 165 |
| 166 if (isCustomTagName(element->localName())) | 166 if (element->isCustomElement()) { |
| 167 return; // custom tags take precedence over type extensions | 167 // This can happen if: |
| 168 // 1. The element has a custom tag, which takes precedence over |
| 169 // type extensions. |
| 170 // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an |
| 171 // element but tries to overwrite its attribute list. |
| 172 return; |
| 173 } |
| 174 |
| 175 // Custom tags take precedence over type extensions |
| 176 ASSERT(!isCustomTagName(element->localName())); |
| 168 | 177 |
| 169 if (CustomElementRegistrationContext* context = element->document()->registr
ationContext()) | 178 if (CustomElementRegistrationContext* context = element->document()->registr
ationContext()) |
| 170 context->didGiveTypeExtension(element, type); | 179 context->didGiveTypeExtension(element, type); |
| 171 } | 180 } |
| 172 | 181 |
| 173 } // namespace WebCore | 182 } // namespace WebCore |
| OLD | NEW |