Chromium Code Reviews

Unified Diff: Source/core/dom/DOMTokenList.cpp

Issue 479243002: Simplify DOMTokenList::validateToken() code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine