Skip to content

Commit

Permalink
Use traverse() instead of the deprecated Walker class
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed May 6, 2021
1 parent e5a93fa commit ceea32d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions strip-test-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ function StripTestSelectorsTransform() {
}

StripTestSelectorsTransform.prototype.transform = function(ast) {
let walker = new this.syntax.Walker();
let { traverse } = this.syntax;

walker.visit(ast, function(node) {
if (node.type === 'ElementNode') {
traverse(ast, {
ElementNode(node) {
node.attributes = node.attributes.filter(function(attribute) {
return !isTestSelector(attribute.name);
});
} else if (node.type === 'MustacheStatement' || node.type === 'BlockStatement') {
},

MustacheStatement(node) {
stripTestSelectors(node);
},

BlockStatement(node) {
stripTestSelectors(node);
}
},
});

return ast;
Expand Down

0 comments on commit ceea32d

Please sign in to comment.