Permalink
Browse files

Optimized goog.dom.classlist.removeAll.

goog.partial is slow because it has to create the 'arguments' array at every call.

R=jeffschiller,gboyer
DELTA=3  (1 added, 0 deleted, 2 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=5804


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2295 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent 8bcb89f commit ed85e0fe31fbdf1c6b421a6e96c683b6c7690c2f pallosp@google.com committed Nov 12, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 closure/goog/dom/classlist.js
View
5 closure/goog/dom/classlist.js
@@ -146,8 +146,9 @@ goog.dom.classlist.remove = goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_ ?
*/
goog.dom.classlist.removeAll = goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_ ?
function(element, classesToRemove) {
- goog.array.forEach(classesToRemove,
- goog.partial(goog.dom.classlist.remove, element));
+ goog.array.forEach(classesToRemove, function(className) {
+ goog.dom.classlist.remove(element, className);
+ });
} :
function(element, classesToRemove) {
// Filter out those classes in classesToRemove.

0 comments on commit ed85e0f

Please sign in to comment.