index.cjs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. const lang = require('./lang.cjs');
  3. const selectorList = {
  4. parse() {
  5. return this.createSingleNodeList(
  6. this.SelectorList()
  7. );
  8. }
  9. };
  10. const selector = {
  11. parse() {
  12. return this.createSingleNodeList(
  13. this.Selector()
  14. );
  15. }
  16. };
  17. const identList = {
  18. parse() {
  19. return this.createSingleNodeList(
  20. this.Identifier()
  21. );
  22. }
  23. };
  24. const langList = {
  25. parse: lang.parseLanguageRangeList
  26. };
  27. const nth = {
  28. parse() {
  29. return this.createSingleNodeList(
  30. this.Nth()
  31. );
  32. }
  33. };
  34. const pseudo = {
  35. 'dir': identList,
  36. 'has': selectorList,
  37. 'lang': langList,
  38. 'matches': selectorList,
  39. 'is': selectorList,
  40. '-moz-any': selectorList,
  41. '-webkit-any': selectorList,
  42. 'where': selectorList,
  43. 'not': selectorList,
  44. 'nth-child': nth,
  45. 'nth-last-child': nth,
  46. 'nth-last-of-type': nth,
  47. 'nth-of-type': nth,
  48. 'slotted': selector,
  49. 'host': selector,
  50. 'host-context': selector
  51. };
  52. module.exports = pseudo;