Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
index 90569898c64ffbe0506a70a3a883229adfe56866..eebcb2d9f9ec13d9c35fa040d817c2d1195b30bb 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
@@ -5,9 +5,31 @@ |
#include "core/dom/custom/CustomElement.h" |
#include "platform/text/Character.h" |
+#include "wtf/text/AtomicStringHash.h" |
namespace blink { |
+bool CustomElement::isValidName(const AtomicString& name) |
+{ |
+ if (!isPotentialCustomElementName(name)) |
+ return false; |
+ |
+ // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name |
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenContainingElementNames, ()); |
+ if (hyphenContainingElementNames.isEmpty()) { |
+ hyphenContainingElementNames.add("annotation-xml"); |
+ hyphenContainingElementNames.add("color-profile"); |
+ hyphenContainingElementNames.add("font-face"); |
+ hyphenContainingElementNames.add("font-face-src"); |
+ hyphenContainingElementNames.add("font-face-uri"); |
+ hyphenContainingElementNames.add("font-face-format"); |
+ hyphenContainingElementNames.add("font-face-name"); |
+ hyphenContainingElementNames.add("missing-glyph"); |
+ } |
+ |
+ return !hyphenContainingElementNames.contains(name); |
+} |
+ |
bool CustomElement::isPotentialCustomElementName(const AtomicString& name) |
{ |
if (!name.length() || name[0] < 'a' || name[0] > 'z') |