OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/dom/custom/CustomElement.h" |
| 6 |
| 7 #include "platform/text/Character.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 bool CustomElement::isPotentialCustomElementName(const AtomicString& name) |
| 12 { |
| 13 if (!name.length() || name[0] < 'a' || name[0] > 'z') |
| 14 return false; |
| 15 |
| 16 bool hasHyphens = false; |
| 17 for (size_t i = 1; i < name.length(); ) { |
| 18 UChar32 ch; |
| 19 if (name.is8Bit()) |
| 20 ch = name[i++]; |
| 21 else |
| 22 U16_NEXT(name.characters16(), i, name.length(), ch); |
| 23 if (ch == '-') |
| 24 hasHyphens = true; |
| 25 else if (!Character::isPotentialCustomElementNameChar(ch)) |
| 26 return false; |
| 27 } |
| 28 return hasHyphens; |
| 29 } |
| 30 |
| 31 } // namespace blink |
OLD | NEW |