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

Side by Side Diff: sky/engine/core/dom/DOMTokenList.cpp

Issue 788093003: Add clear() to Element.classList. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/DOMTokenList.h ('k') | sky/engine/core/dom/DOMTokenList.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const AtomicString& DOMTokenList::value() const 76 const AtomicString& DOMTokenList::value() const
77 { 77 {
78 return m_element->getAttribute(HTMLNames::classAttr); 78 return m_element->getAttribute(HTMLNames::classAttr);
79 } 79 }
80 80
81 void DOMTokenList::setValue(const AtomicString& value) 81 void DOMTokenList::setValue(const AtomicString& value)
82 { 82 {
83 m_element->setAttribute(HTMLNames::classAttr, value); 83 m_element->setAttribute(HTMLNames::classAttr, value);
84 } 84 }
85 85
86 void DOMTokenList::clear()
87 {
88 m_element->removeAttribute(HTMLNames::classAttr);
89 }
90
86 bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionS tate) 91 bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionS tate)
87 { 92 {
88 if (token.isEmpty()) { 93 if (token.isEmpty()) {
89 exceptionState.throwDOMException(SyntaxError, "The token provided must n ot be empty."); 94 exceptionState.throwDOMException(SyntaxError, "The token provided must n ot be empty.");
90 return false; 95 return false;
91 } 96 }
92 97
93 if (token.find(isHTMLSpace) != kNotFound) { 98 if (token.find(isHTMLSpace) != kNotFound) {
94 exceptionState.throwDOMException(InvalidCharacterError, "The token provi ded ('" + token + "') contains HTML space characters, which are not valid in tok ens."); 99 exceptionState.throwDOMException(InvalidCharacterError, "The token provi ded ('" + token + "') contains HTML space characters, which are not valid in tok ens.");
95 return false; 100 return false;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 output.append(' '); 296 output.append(' ');
292 } else { 297 } else {
293 output.append(token); // Step 9 298 output.append(token); // Step 9
294 } 299 }
295 } 300 }
296 301
297 return output.toAtomicString(); 302 return output.toAtomicString();
298 } 303 }
299 304
300 } // namespace blink 305 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/DOMTokenList.h ('k') | sky/engine/core/dom/DOMTokenList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698