File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ var modelProps = {
20
20
'false-value' : '_falseValue'
21
21
}
22
22
23
+ // regex to test for globally allowed attributes:
24
+ // - class
25
+ // - data-*
26
+ // - aria-*
27
+ // - role
28
+ var globalAllowedAttrRE = / ^ c l a s s $ | ^ r o l e $ | ^ d a t a - | ^ a r i a - /
29
+
23
30
module . exports = {
24
31
25
32
priority : 850 ,
@@ -30,17 +37,13 @@ module.exports = {
30
37
if ( this . descriptor . interp ) {
31
38
// only allow binding on native attributes
32
39
if ( ! (
33
- // class is allowed globally
34
- attr === 'class' ||
35
- // data attributes are allowed globally
36
- / ^ d a t a - / . test ( attr ) ||
37
- // aria attributes are allowed globally
38
- / ^ a r i a - / . test ( attr ) ||
39
- // role available
40
- ( attr === 'role' ) ||
41
- // for available
40
+ // globally allowed attributes
41
+ globalAllowedAttrRE . test ( attr ) ||
42
+ // check if "for" is available on current element.
43
+ // the corresponding property is a special case.
42
44
( attr === 'for' && 'htmlFor' in this . el ) ||
43
- // camelized prop available
45
+ // other attributes: check if a camelized property
46
+ // is available on the element
44
47
_ . camelize ( attr ) in this . el
45
48
) ) {
46
49
process . env . NODE_ENV !== 'production' && _ . warn (
You can’t perform that action at this time.
0 commit comments