mediaSlash9.js 706 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const BasePlugin = require('../plugin');
  3. const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
  4. const { MEDIA_QUERY } = require('../dictionary/identifiers');
  5. const { ATRULE } = require('../dictionary/postcss');
  6. module.exports = class MediaSlash9 extends BasePlugin {
  7. /** @param {import('postcss').Result} result */
  8. constructor(result) {
  9. super([IE_5_5, IE_6, IE_7], [ATRULE], result);
  10. }
  11. /**
  12. * @param {import('postcss').AtRule} rule
  13. * @return {void}
  14. */
  15. detect(rule) {
  16. const params = rule.params.trim();
  17. if (params.toLowerCase() === 'screen\\9') {
  18. this.push(rule, {
  19. identifier: MEDIA_QUERY,
  20. hack: params,
  21. });
  22. }
  23. }
  24. };