autoprefixer-rails 0.3.20130427 → 0.3.20130502

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -12,6 +12,10 @@
12
12
  20130427:
13
13
  * Prefix several same values in one property.
14
14
 
15
+ 20130502:
16
+ * Don’t add -webkit- prefix to IE filter.
17
+ * Don’t duplicate already prefixed rules.
18
+
15
19
  == 0.2 (Hear Me Roar!)
16
20
  * Update parse libraries.
17
21
  * Add inspect method and rake tast.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- autoprefixer-rails (0.3.20130427)
4
+ autoprefixer-rails (0.3.20130502)
5
5
  execjs
6
6
 
7
7
  GEM
@@ -98,7 +98,7 @@ GEM
98
98
  libv8 (~> 3.11.8.12)
99
99
  ref
100
100
  thor (0.18.1)
101
- tilt (1.3.7)
101
+ tilt (1.4.0)
102
102
  treetop (1.4.12)
103
103
  polyglot
104
104
  polyglot (>= 0.3.1)
@@ -1,3 +1,3 @@
1
1
  module AutoprefixerRails
2
- VERSION = '0.3.20130427'.freeze unless defined? AutoprefixerRails::VERSION
2
+ VERSION = '0.3.20130502'.freeze unless defined? AutoprefixerRails::VERSION
3
3
  end
@@ -4657,7 +4657,10 @@ module.exports = {
4657
4657
  "safari 6",
4658
4658
  "ios 6"
4659
4659
  ],
4660
- transition: true
4660
+ transition: true,
4661
+ check: function () {
4662
+ return !this.match(/DXImageTransform\.Microsoft/);
4663
+ }
4661
4664
  },
4662
4665
  flex: {
4663
4666
  browsers: [
@@ -6152,7 +6155,41 @@ var autoprefixer = {
6152
6155
  // Change `style` declarations in parsed `css`, to add prefixes for `props`.
6153
6156
  prefixer: function (props, style, css) {
6154
6157
  if ( props['@keyframes'] ) {
6155
- css.use( rework.keyframes(props['@keyframes'].prefixes) );
6158
+ // Keyframes
6159
+
6160
+ style.rules.forEach(function(rule) {
6161
+ if ( !rule.keyframes ) {
6162
+ return;
6163
+ }
6164
+
6165
+ props['@keyframes'].prefixes.forEach(function (prefix) {
6166
+ var contain = style.rules.some(function (other) {
6167
+ return other.keyframes && rule.name == other.name &&
6168
+ other.vendor == prefix;
6169
+ });
6170
+ if ( contain ) {
6171
+ return;
6172
+ }
6173
+
6174
+ var clone = { name: rule.name };
6175
+ clone.vendor = rule.vendor;
6176
+ clone.keyframes = [];
6177
+ rule.keyframes.forEach(function (keyframe) {
6178
+ var keyframeClone = { };
6179
+ keyframeClone.values = keyframe.values.slice();
6180
+ keyframeClone.declarations = keyframe.declarations.map(
6181
+ function (i) {
6182
+ return { property: i.property, value: i.value };
6183
+ });
6184
+
6185
+ clone.keyframes.push(keyframeClone);
6186
+ });
6187
+
6188
+
6189
+ clone.vendor = prefix;
6190
+ style.rules.push(clone);
6191
+ });
6192
+ });
6156
6193
  }
6157
6194
 
6158
6195
  var all = props['*'];
@@ -6165,7 +6202,22 @@ var autoprefixer = {
6165
6202
  var isTransition = /(-(webkit|moz|ms|o)-)?transition(-property)?/;
6166
6203
 
6167
6204
  rework.visit.declarations(style, function (rules, node) {
6168
- var vendor = node.vendor;
6205
+ var vendor = node.vendor;
6206
+ var prefixes = ['-webkit-', '-moz-', '-ms-', '-o-'];
6207
+
6208
+ var contain = function (rules, prop, value) {
6209
+ return rules.some(function (rule) {
6210
+ return rule.property == prop && rule.value == value;
6211
+ });
6212
+ };
6213
+ var add = function (rules, num, prop, value) {
6214
+ if ( contain(rules, prop, value) ) {
6215
+ return num;
6216
+ }
6217
+
6218
+ rules.splice(num, 0, { property: prop, value: value });
6219
+ return num + 1;
6220
+ };
6169
6221
 
6170
6222
  // Properties
6171
6223
  for ( var num = 0; num < rules.length; num += 1 ) {
@@ -6175,17 +6227,25 @@ var autoprefixer = {
6175
6227
  if ( !prop || !prop.prefixes ) {
6176
6228
  continue;
6177
6229
  }
6230
+ if ( prop.check && !prop.check.call(rule.value, rule) ) {
6231
+ continue;
6232
+ }
6178
6233
 
6179
6234
  prop.prefixes.forEach(function (prefix) {
6180
6235
  if ( vendor && vendor != prefix ) {
6181
6236
  return;
6182
6237
  }
6183
-
6184
- rules.splice(num, 0, {
6185
- property: prefix + rule.property,
6186
- value: rule.value
6238
+ var wrong = prefixes.some(function (other) {
6239
+ if ( other == prefix ) {
6240
+ return false;
6241
+ }
6242
+ return rule.value.indexOf(other) != -1;
6187
6243
  });
6188
- num += 1;
6244
+ if ( wrong ) {
6245
+ return;
6246
+ }
6247
+
6248
+ num = add(rules, num, prefix + rule.property, rule.value);
6189
6249
  });
6190
6250
  };
6191
6251
 
@@ -6222,13 +6282,16 @@ var autoprefixer = {
6222
6282
  for ( var prefix in prefixed ) {
6223
6283
  if ( prefixed[prefix] != rule.value ) {
6224
6284
  if ( propVendor ) {
6225
- rule.value = prefixed[prefix];
6285
+ var exists = contain(rules, rule.property,
6286
+ prefixed[prefix]);
6287
+ if ( exists ) {
6288
+ rules.splice(num, 1);
6289
+ } else {
6290
+ rule.value = prefixed[prefix];
6291
+ }
6226
6292
  } else {
6227
- rules.splice(num, 0, {
6228
- property: rule.property,
6229
- value: prefixed[prefix]
6230
- });
6231
- num += 1;
6293
+ num = add(rules, num, rule.property,
6294
+ prefixed[prefix]);
6232
6295
  }
6233
6296
  }
6234
6297
  }
@@ -6341,21 +6404,19 @@ var autoprefixer = {
6341
6404
  if ( prefixes.length ) {
6342
6405
  prefixes = uniq(prefixes);
6343
6406
 
6344
- if ( data[name].props ) {
6345
- selected[name] = {
6346
- props: data[name].props,
6347
- regexp: containRegexp(name),
6348
- prefixes: prefixes
6349
- };
6350
- } else if (data[name].transition) {
6351
- selected[name] = {
6352
- regexp: containRegexp(name),
6353
- prefixes: prefixes,
6354
- transition: true
6355
- };
6356
- } else {
6357
- selected[name] = { prefixes: prefixes };
6407
+ var obj = { prefixes: prefixes }
6408
+ for ( var key in data[name] ) {
6409
+ if ( key == 'browsers' ) {
6410
+ continue;
6411
+ }
6412
+ obj[key] = data[name][key];
6358
6413
  }
6414
+
6415
+ if ( obj.props || obj.transition ) {
6416
+ obj.regexp = containRegexp(name);
6417
+ }
6418
+
6419
+ selected[name] = obj;
6359
6420
  }
6360
6421
  }
6361
6422
  return selected;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoprefixer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20130427
4
+ version: 0.3.20130502
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-27 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: -960317650164460838
85
+ hash: -3902734870157313034
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: -960317650164460838
94
+ hash: -3902734870157313034
95
95
  requirements: []
96
96
  rubyforge_project:
97
97
  rubygems_version: 1.8.23