You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6 KiB

4 years ago
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _postcssSelectorParser = require('postcss-selector-parser');
  6. var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
  7. var _exists = require('../exists');
  8. var _exists2 = _interopRequireDefault(_exists);
  9. var _isMixin = require('../isMixin');
  10. var _isMixin2 = _interopRequireDefault(_isMixin);
  11. var _plugin = require('../plugin');
  12. var _plugin2 = _interopRequireDefault(_plugin);
  13. var _browsers = require('../dictionary/browsers');
  14. var _identifiers = require('../dictionary/identifiers');
  15. var _postcss = require('../dictionary/postcss');
  16. var _tags = require('../dictionary/tags');
  17. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18. function analyse(ctx, rule) {
  19. return selectors => {
  20. selectors.each(selector => {
  21. if ((0, _exists2.default)(selector, 0, '*') && (0, _exists2.default)(selector, 1, ' ') && (0, _exists2.default)(selector, 2, _tags.HTML) && (0, _exists2.default)(selector, 3, ' ') && selector.at(4)) {
  22. ctx.push(rule, {
  23. identifier: _identifiers.SELECTOR,
  24. hack: selector.toString()
  25. });
  26. }
  27. });
  28. };
  29. }
  30. exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6], [_postcss.RULE], function (rule) {
  31. if ((0, _isMixin2.default)(rule)) {
  32. return;
  33. }
  34. (0, _postcssSelectorParser2.default)(analyse(this, rule)).processSync(rule.selector);
  35. });
  36. module.exports = exports['default'];