Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 1916013004: Implement PotentialCustomElementName (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tkent review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698