@@ -29,17 +29,17 @@ export const analyse = (text: string): Diagnostic[] => {
29
29
30
30
// HTML parser
31
31
const document = parse ( text ) ;
32
- ELEMENT_DEFINITIONS . forEach ( ( [ tagName , attNames ] ) => {
32
+ ELEMENT_DEFINITIONS . forEach ( ( { tagName, attributes } ) => {
33
33
const els = document . querySelectorAll ( tagName ) ;
34
34
els . forEach ( ( el ) => {
35
- attNames . forEach ( ( att ) => {
35
+ attributes . forEach ( ( attribute ) => {
36
36
let iStart = el . range [ 0 ] ;
37
37
let iEnd = el . range [ 1 ] ;
38
- if ( el . hasAttribute ( att . name ) ) {
38
+ if ( el . hasAttribute ( attribute . name ) ) {
39
39
// Try to parse it
40
- const value = el . getAttribute ( att . name ) ;
40
+ const value = el . getAttribute ( attribute . name ) ;
41
41
if ( value !== undefined ) {
42
- switch ( att . format ) {
42
+ switch ( attribute . format ) {
43
43
case ( "json" ) :
44
44
try {
45
45
JSON . parse ( value )
@@ -56,7 +56,7 @@ export const analyse = (text: string): Diagnostic[] => {
56
56
character : characterNumber [ iEnd ] ,
57
57
} ,
58
58
} ,
59
- message : `Could not parse: '${ att . name } ' into ${ att . format } .` ,
59
+ message : `Could not parse: '${ attribute . name } ' into ${ attribute . format } .` ,
60
60
} ) ;
61
61
}
62
62
break ;
@@ -74,7 +74,7 @@ export const analyse = (text: string): Diagnostic[] => {
74
74
character : characterNumber [ iEnd ] ,
75
75
} ,
76
76
} ,
77
- message : `Could not parse: '${ att . name } ' into ${ att . format } .` ,
77
+ message : `Could not parse: '${ attribute . name } ' into ${ attribute . format } .` ,
78
78
} ) ;
79
79
}
80
80
break ;
@@ -93,7 +93,7 @@ export const analyse = (text: string): Diagnostic[] => {
93
93
} ,
94
94
end : { line : lineNumber [ iEnd ] , character : characterNumber [ iEnd ] } ,
95
95
} ,
96
- message : `Missing '${ att . name } ' HTML attribute.` ,
96
+ message : `Missing '${ attribute . name } ' HTML attribute.` ,
97
97
} ) ;
98
98
}
99
99
} ) ;
0 commit comments