Commit 8563ede3 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Simplify DOMTokenList::validateToken() code

Simplify DOMTokenList::validateToken() code by calling WTFString::find()
instead of manually iterating through the String to find HTML spaces.

R=rob.buis@samsung.com

Review URL: https://codereview.chromium.org/479243002

git-svn-id: svn://svn.chromium.org/blink/trunk@180486 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9ac02465
...@@ -39,12 +39,9 @@ bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionS ...@@ -39,12 +39,9 @@ bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionS
return false; return false;
} }
unsigned length = token.length(); if (token.find(isHTMLSpace) != kNotFound) {
for (unsigned i = 0; i < length; ++i) { exceptionState.throwDOMException(InvalidCharacterError, "The token provided ('" + token + "') contains HTML space characters, which are not valid in tokens.");
if (isHTMLSpace<UChar>(token[i])) { return false;
exceptionState.throwDOMException(InvalidCharacterError, "The token provided ('" + token + "') contains HTML space characters, which are not valid in tokens.");
return false;
}
} }
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment