Skip to content

Commit

Permalink
Avoid triggering ember.js#19392 with synthetic attr nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Mar 23, 2022
1 parent 084cd33 commit ff5bf48
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/ember-css-modules/lib/htmlbars-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ module.exports = class ClassTransformPlugin {

utils.pushAll(parts, this.localToPath(localClassAttr.value));
this.divide(parts, 'text');
node.attributes.unshift(
this.builders.attr('class', this.builders.concat(parts))
);

let newClassAttr = this.builders.attr('class', this.builders.concat(parts));
node.attributes.unshift(newClassAttr);

// Create a fake good-enough `loc` whose content will start with `class=`
// to avoid triggering https://github.com/emberjs/ember.js/issues/19392
newClassAttr.loc = localClassAttr.loc.slice({ skipStart: 'local-'.length });
}

localToPath(node) {
Expand Down

0 comments on commit ff5bf48

Please sign in to comment.