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

Unified Diff: Source/core/dom/custom/CustomElement.cpp

Issue 493713002: Invalid chars should not be allowed as first character in custom element name (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/custom/invalid-first-char-combinators-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/custom/CustomElement.cpp
diff --git a/Source/core/dom/custom/CustomElement.cpp b/Source/core/dom/custom/CustomElement.cpp
index 81443a6c9fe2356d4b3c4ef14bd870419b4082ae..b54fd5b541bfe1c6ea21f4464c7968a41e3bca7e 100644
--- a/Source/core/dom/custom/CustomElement.cpp
+++ b/Source/core/dom/custom/CustomElement.cpp
@@ -71,7 +71,7 @@ bool CustomElement::isValidName(const AtomicString& name, NameSet validNames)
if ((validNames & EmbedderNames) && kNotFound != embedderCustomElementNames().find(name))
return Document::isValidName(name);
- if ((validNames & StandardNames) && kNotFound != name.find('-')) {
+ if ((validNames & StandardNames) && kNotFound != name.find('-') && kNotFound == name.find(':')) {
dglazkov 2014/10/16 17:41:26 This change is good.
DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
if (reservedNames.isEmpty()) {
reservedNames.append(MathMLNames::annotation_xmlTag.localName());
@@ -85,8 +85,15 @@ bool CustomElement::isValidName(const AtomicString& name, NameSet validNames)
#endif
}
- if (kNotFound == reservedNames.find(name))
+ if (kNotFound == reservedNames.find(name)) {
+ if (!name.string().is8Bit()) {
+ const UChar32 c = name.characters16()[0];
+ if (c == 0x0B83 || c == 0x0F88 || c == 0x0F89 || c == 0x0F8A || c == 0x0F8B)
dglazkov 2014/10/07 15:13:13 This set of character comparisons seems out of pla
dglazkov 2014/10/16 17:41:26 What I meant to say here is that you should not be
+ return false;
+ }
+
return Document::isValidName(name.string());
+ }
}
return false;
« no previous file with comments | « LayoutTests/fast/dom/custom/invalid-first-char-combinators-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698