Skip to content

Commit

Permalink
fix: added regexp exception (fixes posthtml#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Feb 9, 2023
1 parent d8c2385 commit 24ca334
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ function expandMatcher (matcher) {
}

if (className) {
attributes.class = new RegExp(getCombinations(className.split(".")).map(function(order){
return "(?:^|\\s)" + order.join("\\s(?:.*?\\s)?") + "(?:\\s|$)";
}).join("|"));
try {
attributes.class = new RegExp(getCombinations(className.split(".")).map(function(order){
return "(?:^|\\s)" + order.join("\\s(?:.*?\\s)?") + "(?:\\s|$)";
}).join("|"));
} catch { }
}

if (attributes) {
Expand Down

1 comment on commit 24ca334

@titanism
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already fixed spaces to tabs, see latest commit in PR. It's ready to go.

Please sign in to comment.