Skip to content

Commit

Permalink
fix: demo snippet sanitation for target="_blank" (#5301)
Browse files Browse the repository at this point in the history
* Fix demo snippet sanitation so that it doesn't get confused by target="_blank" when excluding sprouted private properties from the formatted code sample.
  • Loading branch information
dbatiste authored Jan 9, 2025
1 parent 8210300 commit 0b5d8bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/demo/demo-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class DemoSnippet extends LitElement {

return lines.join('\n')
.replace(/ class=""/g, '') // replace empty class attributes (class="")
.replace(/_[^=]*="[^"]*"/, '') // replace private reflected properties (_attr="value")
.replace(/\s+_[^\s/>"'=]*(=(?<q>['"]).*?(?<!\\)\k<q>)?/g, '') // replace private reflected properties (_attr, _attr="value", but not target="_blank")
.replace(/=""/g, ''); // replace empty strings for boolean attributes (="")
}

Expand Down

0 comments on commit 0b5d8bf

Please sign in to comment.