Files
hudozka/node_modules/gulp-autoprefixer/node_modules/autoprefixer/lib/declaration.js
T
tmshv a71eb79001 + gulp-autoprefixer node module;
= package.json gulp-autoprifixer field;
2014-03-15 14:42:39 +04:00

82 lines
2.2 KiB
JavaScript

(function() {
var Browsers, Declaration, Prefixer, vendor,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Prefixer = require('./prefixer');
Browsers = require('./browsers');
vendor = require('postcss/lib/vendor');
Declaration = (function(_super) {
__extends(Declaration, _super);
function Declaration() {
return Declaration.__super__.constructor.apply(this, arguments);
}
Declaration.prototype.check = function(decl) {
return true;
};
Declaration.prototype.prefixed = function(prop, prefix) {
return prefix + prop;
};
Declaration.prototype.normalize = function(prop) {
return prop;
};
Declaration.prototype.otherPrefixes = function(value, prefix) {
var other, _i, _len, _ref;
_ref = Browsers.prefixes();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
other = _ref[_i];
if (other === prefix) {
continue;
}
if (value.indexOf(other) !== -1) {
return true;
}
}
return false;
};
Declaration.prototype.set = function(decl, prefix) {
decl.prop = this.prefixed(decl.prop, prefix);
return decl;
};
Declaration.prototype.insert = function(decl, prefix) {
var cloned;
cloned = this.set(this.clone(decl), prefix);
if (cloned) {
return decl.parent.insertBefore(decl, cloned);
}
};
Declaration.prototype.add = function(decl, prefix) {
var already, prefixed;
prefixed = this.prefixed(decl.prop, prefix);
already = this.all.group(decl).up(function(i) {
return i.prop === prefixed;
});
if (already || this.otherPrefixes(decl.value, prefix)) {
return;
}
return this.insert(decl, prefix);
};
Declaration.prototype.old = function(prop, prefix) {
return [this.prefixed(prop, prefix)];
};
return Declaration;
})(Prefixer);
module.exports = Declaration;
}).call(this);