Browse Source

Use precompiled RegExp.

pull/296/head
Bogdan Mustiata 10 years ago
parent
commit
f802c84d05
  1. 9
      Sortable.js

9
Sortable.js

@ -889,6 +889,8 @@
el.removeEventListener(event, fn, false);
}
/** @const */
var RSPACE = /\s+/g;
function _toggleClass(el, name, state) {
if (el) {
@ -896,11 +898,8 @@
el.classList[state ? 'add' : 'remove'](name);
}
else {
var className = (' ' + el.className + ' ')
.replace(/\s+/g, ' ')
.replace(' ' + name + ' ', ' ')
.replace(/ /, ' ');
el.className = className + (state ? ' ' + name : '');
var className = (' ' + el.className + ' ').replace(RSPACE, ' ').replace(' ' + name + ' ', ' ');
el.className = (className + (state ? ' ' + name : '')).replace(RSPACE, ' ');
}
}
}

Loading…
Cancel
Save