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 == '-') | |
dominicc (has gone to gerrit)
2016/04/27 01:42:14
Maybe hasHyphens |= ch == '-' is more succinct?
kojii
2016/04/27 03:52:13
We don't have to call Character::isPotentialCustom
| |
24 hasHyphens = true; | |
25 else if (!Character::isPotentialCustomElementNameChar(ch)) | |
26 return false; | |
27 } | |
28 return hasHyphens; | |
dominicc (has gone to gerrit)
2016/04/27 01:42:14
This also needs to filter out
annotation-xml
colo
kojii
2016/04/27 03:52:13
Agreed. If I read the spec correctly,
valid cust
| |
29 } | |
30 | |
31 } // namespace blink | |
OLD | NEW |