Permalink
Browse files

increase perf another %10 with for loops in prefix()

  • Loading branch information...
1 parent 94603ba commit 1af0d2d38453b8e6f23fda0bc70ab780751c9a66 @tj tj committed Oct 6, 2012
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/plugins/prefix.js
View
14 lib/plugins/prefix.js
@@ -51,9 +51,11 @@ function prefixKeyframes(props, vendors, rule) {
*/
function prefix(props, vendors, declarations, only) {
- props.forEach(function(prop){
- declarations.forEach(function(decl, i){
- if (prop != decl.property) return;
+ for (var i = 0; i < props.length; ++i) {
+ var prop = props[i];
+ for (var j = 0, len = declarations.length; j < len; ++j) {
+ var decl = declarations[j];
+ if (prop != decl.property) continue;
// vendor prefixed props
vendors.forEach(function(vendor){
@@ -66,7 +68,7 @@ function prefix(props, vendors, declarations, only) {
// original prop
declarations.push(decl);
- declarations.splice(i, 1);
- });
- });
+ declarations.splice(j, 1);
+ }
+ }
}

0 comments on commit 1af0d2d

Please sign in to comment.