@@ -7,38 +7,38 @@ const {
7
7
} = require ( './mapping' ) ;
8
8
9
9
/**
10
- * returns true if given parent-child nesting is valid html
10
+ * returns true if given parent-child nesting is valid HTML
11
11
* @param {string } child
12
12
* @param {string } parent
13
13
* @returns {boolean }
14
14
*/
15
15
function isValidHTMLNesting ( parent , child ) {
16
- // if we know the list of children that are the only valid chidren for given parent
16
+ // if we know the list of children that are the only valid children for the given parent
17
17
if ( parent in onlyValidChildren ) {
18
18
return onlyValidChildren [ parent ] . has ( child ) ;
19
19
}
20
20
21
- // if we know the list of parents that are the only valid parents for given child
21
+ // if we know the list of parents that are the only valid parents for the given child
22
22
if ( child in onlyValidParents ) {
23
23
return onlyValidParents [ child ] . has ( parent ) ;
24
24
}
25
25
26
- // if we know the lsit of children that not valid for given parent
26
+ // if we know the list of children that are NOT valid for the given parent
27
27
if ( parent in knownInvalidChildren ) {
28
- // check if child is in the list of invalid children
28
+ // check if the child is in the list of invalid children
29
29
// if so, return false
30
30
if ( knownInvalidChildren [ parent ] . has ( child ) ) return false ;
31
31
}
32
32
33
- // if we know list of parents that are not valid for given children
33
+ // if we know the list of parents that are NOT valid for the given child
34
34
if ( child in knownInvalidParents ) {
35
- // check if parent is in the list of invalid parents
35
+ // check if the parent is in the list of invalid parents
36
36
// if so, return false
37
37
if ( knownInvalidParents [ child ] . has ( parent ) ) return false ;
38
38
}
39
39
40
- // svg tags should only contain svg tags
41
- if ( svgTags . has ( parent ) && child !== "a" && ! svgTags . has ( child ) ) {
40
+ // SVG tags should only contain SVG tags or anchor tag
41
+ if ( svgTags . has ( parent ) && child !== 'a' && ! svgTags . has ( child ) ) {
42
42
return false ;
43
43
}
44
44
0 commit comments