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.

27 lines
569 B

1 month ago
  1. 'use strict'
  2. let Container = require('./container')
  3. let list = require('./list')
  4. class Rule extends Container {
  5. get selectors() {
  6. return list.comma(this.selector)
  7. }
  8. set selectors(values) {
  9. let match = this.selector ? this.selector.match(/,\s*/) : null
  10. let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen')
  11. this.selector = values.join(sep)
  12. }
  13. constructor(defaults) {
  14. super(defaults)
  15. this.type = 'rule'
  16. if (!this.nodes) this.nodes = []
  17. }
  18. }
  19. module.exports = Rule
  20. Rule.default = Rule
  21. Container.registerRule(Rule)