Index: Source/core/dom/DOMTokenList.cpp |
diff --git a/Source/core/dom/DOMTokenList.cpp b/Source/core/dom/DOMTokenList.cpp |
index 8fb49799e7bd43dd29baa553051fd34b5f49ff5d..b434de742135c97e057c103ca3a1c70f0ba875c1 100644 |
--- a/Source/core/dom/DOMTokenList.cpp |
+++ b/Source/core/dom/DOMTokenList.cpp |
@@ -39,12 +39,9 @@ bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionS |
return false; |
} |
- unsigned length = token.length(); |
- for (unsigned i = 0; i < length; ++i) { |
- if (isHTMLSpace<UChar>(token[i])) { |
- exceptionState.throwDOMException(InvalidCharacterError, "The token provided ('" + token + "') contains HTML space characters, which are not valid in tokens."); |
- return false; |
- } |
+ if (token.find(isHTMLSpace) != kNotFound) { |
+ exceptionState.throwDOMException(InvalidCharacterError, "The token provided ('" + token + "') contains HTML space characters, which are not valid in tokens."); |
+ return false; |
} |
return true; |