Sha256: d78349b6215785308f3c94f73af2254970192fae253db112aea98f2a67e07bef

Contents?: true

Size: 1.84 KB

Versions: 17

Compression:

Stored size: 1.84 KB

Contents

"use strict";

function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }

var Prefixer = require('./prefixer');

var AtRule =
/*#__PURE__*/
function (_Prefixer) {
  _inheritsLoose(AtRule, _Prefixer);

  function AtRule() {
    return _Prefixer.apply(this, arguments) || this;
  }

  var _proto = AtRule.prototype;

  /**
     * Clone and add prefixes for at-rule
     */
  _proto.add = function add(rule, prefix) {
    var prefixed = prefix + rule.name;
    var already = rule.parent.some(function (i) {
      return i.name === prefixed && i.params === rule.params;
    });

    if (already) {
      return undefined;
    }

    var cloned = this.clone(rule, {
      name: prefixed
    });
    return rule.parent.insertBefore(rule, cloned);
  }
  /**
     * Clone node with prefixes
     */
  ;

  _proto.process = function process(node) {
    var parent = this.parentPrefix(node);

    for (var _iterator = this.prefixes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref;

      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref = _i.value;
      }

      var prefix = _ref;

      if (!parent || parent === prefix) {
        this.add(node, prefix);
      }
    }
  };

  return AtRule;
}(Prefixer);

module.exports = AtRule;

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.18.2 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.16.1 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.15.2 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.18.4 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.18.1 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.14.0 test/dummy/node_modules/autoprefixer/lib/at-rule.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/autoprefixer/lib/at-rule.js
enju_library-0.3.8 spec/dummy/node_modules/autoprefixer/lib/at-rule.js
jester-data-8.0.0 node_modules/autoprefixer/lib/at-rule.js
ezii-os-5.2.1 node_modules/autoprefixer/lib/at-rule.js
ezii-os-2.0.1 node_modules/autoprefixer/lib/at-rule.js
ezii-os-1.1.0 node_modules/autoprefixer/lib/at-rule.js
ezii-os-1.0.0 node_modules/autoprefixer/lib/at-rule.js
ezii-os-0.0.0.1.0 node_modules/autoprefixer/lib/at-rule.js
ezii-os-0.0.0.0.1 node_modules/autoprefixer/lib/at-rule.js