wishthis/node_modules/postcss/lib/rule.js

28 lines
569 B
JavaScript
Raw Normal View History

2023-08-17 09:47:40 +00:00
'use strict'
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
let Container = require('./container')
let list = require('./list')
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
class Rule extends Container {
constructor(defaults) {
super(defaults)
this.type = 'rule'
if (!this.nodes) this.nodes = []
2022-01-21 08:28:41 +00:00
}
2023-08-17 09:47:40 +00:00
get selectors() {
return list.comma(this.selector)
}
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
set selectors(values) {
let match = this.selector ? this.selector.match(/,\s*/) : null
let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen')
this.selector = values.join(sep)
}
}
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
module.exports = Rule
Rule.default = Rule
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
Container.registerRule(Rule)