BVB Source Codes

reactide Show prefixer.js Source code

Return Download reactide: download prefixer.js Source code - Download reactide Source code - Type:.js
  1. (function() {
  2.   var Browsers, Prefixer, clone, utils, vendor,
  3.     hasProp = {}.hasOwnProperty;
  4.  
  5.   Browsers = require('./browsers');
  6.  
  7.   utils = require('./utils');
  8.  
  9.   vendor = require('postcss/lib/vendor');
  10.  
  11.   clone = function(obj, parent) {
  12.     var cloned, i, value;
  13.     cloned = new obj.constructor();
  14.     for (i in obj) {
  15.       if (!hasProp.call(obj, i)) continue;
  16.       value = obj[i];
  17.       if (i === 'parent' && typeof value === 'object') {
  18.         if (parent) {
  19.           cloned[i] = parent;
  20.         }
  21.       } else if (i === 'source') {
  22.         cloned[i] = value;
  23.       } else if (i === null) {
  24.         cloned[i] = value;
  25.       } else if (value instanceof Array) {
  26.         cloned[i] = value.map(function(i) {
  27.           return clone(i, cloned);
  28.         });
  29.       } else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
  30.         if (typeof value === 'object' && value !== null) {
  31.           value = clone(value, cloned);
  32.         }
  33.         cloned[i] = value;
  34.       }
  35.     }
  36.     return cloned;
  37.   };
  38.  
  39.   Prefixer = (function() {
  40.     Prefixer.hack = function(klass) {
  41.       var j, len, name, ref, results;
  42.       this.hacks || (this.hacks = {});
  43.       ref = klass.names;
  44.       results = [];
  45.       for (j = 0, len = ref.length; j < len; j++) {
  46.         name = ref[j];
  47.         results.push(this.hacks[name] = klass);
  48.       }
  49.       return results;
  50.     };
  51.  
  52.     Prefixer.load = function(name, prefixes, all) {
  53.       var klass, ref;
  54.       klass = (ref = this.hacks) != null ? ref[name] : void 0;
  55.       if (klass) {
  56.         return new klass(name, prefixes, all);
  57.       } else {
  58.         return new this(name, prefixes, all);
  59.       }
  60.     };
  61.  
  62.     Prefixer.clone = function(node, overrides) {
  63.       var cloned, name;
  64.       cloned = clone(node);
  65.       for (name in overrides) {
  66.         cloned[name] = overrides[name];
  67.       }
  68.       return cloned;
  69.     };
  70.  
  71.     function Prefixer(name1, prefixes1, all1) {
  72.       this.name = name1;
  73.       this.prefixes = prefixes1;
  74.       this.all = all1;
  75.     }
  76.  
  77.     Prefixer.prototype.parentPrefix = function(node) {
  78.       var prefix;
  79.       prefix = node._autoprefixerPrefix != null ? node._autoprefixerPrefix : node.type === 'decl' && node.prop[0] === '-' ? vendor.prefix(node.prop) : node.type === 'root' ? false : node.type === 'rule' && node.selector.indexOf(':-') !== -1 && /:(-\w+-)/.test(node.selector) ? node.selector.match(/:(-\w+-)/)[1] : node.type === 'atrule' && node.name[0] === '-' ? vendor.prefix(node.name) : this.parentPrefix(node.parent);
  80.       if (Browsers.prefixes().indexOf(prefix) === -1) {
  81.         prefix = false;
  82.       }
  83.       return node._autoprefixerPrefix = prefix;
  84.     };
  85.  
  86.     Prefixer.prototype.process = function(node) {
  87.       var added, j, k, len, len1, parent, prefix, prefixes, ref;
  88.       if (!this.check(node)) {
  89.         return;
  90.       }
  91.       parent = this.parentPrefix(node);
  92.       prefixes = [];
  93.       ref = this.prefixes;
  94.       for (j = 0, len = ref.length; j < len; j++) {
  95.         prefix = ref[j];
  96.         if (parent && parent !== utils.removeNote(prefix)) {
  97.           continue;
  98.         }
  99.         prefixes.push(prefix);
  100.       }
  101.       added = [];
  102.       for (k = 0, len1 = prefixes.length; k < len1; k++) {
  103.         prefix = prefixes[k];
  104.         if (this.add(node, prefix, added.concat([prefix]))) {
  105.           added.push(prefix);
  106.         }
  107.       }
  108.       return added;
  109.     };
  110.  
  111.     Prefixer.prototype.clone = function(node, overrides) {
  112.       return Prefixer.clone(node, overrides);
  113.     };
  114.  
  115.     return Prefixer;
  116.  
  117.   })();
  118.  
  119.   module.exports = Prefixer;
  120.  
  121. }).call(this);
  122.  
downloadprefixer.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top