Skip to content

Commit

Permalink
Make x-attr regexp stricter to not match e.g. 'xxx-show' or 'x-showso…
Browse files Browse the repository at this point in the history
…mething'.
  • Loading branch information
philippbosch committed Mar 6, 2020
1 parent c7015e4 commit c8c8d02
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/alpine-ie11.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/alpine-ie11.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/alpine.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function saferEvalNoReturn(expression, dataContext, additionalHelperVaria
export function isXAttr(attr) {
const name = replaceAtAndColonWithStandardSyntax(attr.name)

const xAttrRE = /x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref)/
const xAttrRE = /^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref)\b/

return xAttrRE.test(name)
}
Expand All @@ -83,7 +83,7 @@ export function getXAttrs(el, type) {
.map(attr => {
const name = replaceAtAndColonWithStandardSyntax(attr.name)

const typeMatch = name.match(/x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref)/)
const typeMatch = name.match(/^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref)\b/)
const valueMatch = name.match(/:([a-zA-Z\-:]+)/)
const modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []

Expand Down

0 comments on commit c8c8d02

Please sign in to comment.