@extjs/sencha-cmd-linux-32
Version:
Productivity and performance optimization tool for building applications with Sencha Ext JS and Sencha Touch.
72 lines (61 loc) • 1.59 kB
JavaScript
;
var Fashion = require('./export/Base.js');
var TypeVisitor = require('./type/TypeVisitor.js');
class PlaceholderProcessor extends TypeVisitor {
constructor(cfg) {
super(cfg);
}
literal(obj) {
if (obj.getHash() === '%') {
this.hasPlaceholder = true;
}
}
selector(obj) {
if (obj.selectorType === 'placeholder') {
this.hasPlaceholder = true;
}
}
selectorlist(obj) {
var items = obj.items,
len = items.length,
i, item, newItems = [];
for (i = 0; i < len; i++) {
item = items[i];
this.hasPlaceholder = false;
this.visit(item);
if (!this.hasPlaceholder) {
newItems.push(item);
}
}
obj.items = newItems;
return false;
}
ruleset(obj) {
this.hasPlaceholder = false;
this.visit(obj.selectors);
if (this.hasPlaceholder) {
obj.selectors = null
}
this.visit(obj.children);
return false;
}
process(css) {
this.visit(css);
if (!css.selectors || css.selectors.length === 0) {
return;
}
this.outCss.push(css);
}
processRulesets(css) {
this.outCss = [];
for (var i = 0; i < css.length; i++) {
this.process(css[i]);
}
return this.outCss;
}
}
Fashion.apply(PlaceholderProcessor.prototype, {
hasPlaceholder: false,
outCss: null
});
module.exports = PlaceholderProcessor;