Skip to content

Commit

Permalink
Remove duplication of x-attr regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
philippbosch committed Mar 5, 2020
1 parent c0edd70 commit e5d1baf
Show file tree
Hide file tree
Showing 5 changed files with 7 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.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ export function saferEvalNoReturn(expression, dataContext, additionalHelperVaria
)
}

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

export function isXAttr(attr) {
const name = replaceAtAndColonWithStandardSyntax(attr.name)

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

return xAttrRE.test(name)
}

Expand All @@ -83,7 +82,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)\b/)
const typeMatch = name.match(xAttrRE)
const valueMatch = name.match(/:([a-zA-Z\-:]+)/)
const modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []

Expand Down

0 comments on commit e5d1baf

Please sign in to comment.