1
0
mirror of https://github.com/thangisme/notes.git synced 2024-06-29 13:45:25 +00:00
notes/node_modules/autoprefixer/lib/hacks/cross-fade.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

54 lines
1.7 KiB
JavaScript

(function() {
var CrossFade, OldValue, Value, list, utils,
extend = 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; },
hasProp = {}.hasOwnProperty;
OldValue = require('../old-value');
Value = require('../value');
utils = require('../utils');
list = require('postcss/lib/list');
CrossFade = (function(superClass) {
extend(CrossFade, superClass);
function CrossFade() {
return CrossFade.__super__.constructor.apply(this, arguments);
}
CrossFade.names = ['cross-fade'];
CrossFade.prototype.replace = function(string, prefix) {
return list.space(string).map((function(_this) {
return function(value) {
var after, args, close, match;
if (value.slice(0, +_this.name.length + 1 || 9e9) !== _this.name + '(') {
return value;
}
close = value.lastIndexOf(')');
after = value.slice(close + 1);
args = value.slice(_this.name.length + 1, +(close - 1) + 1 || 9e9);
if (prefix === '-webkit-') {
match = args.match(/\d*.?\d+%?/);
if (match) {
args = args.slice(match[0].length).trim();
args += ', ' + match[0];
} else {
args += ', 0.5';
}
}
return prefix + _this.name + '(' + args + ')' + after;
};
})(this)).join(' ');
};
return CrossFade;
})(Value);
module.exports = CrossFade;
}).call(this);