@@ -19,20 +19,28 @@ function has(array: Array<string>, item: string): boolean {
1919function checkURI ( tagName : Nullable < string > , attribute : string ) : boolean {
2020 // SVG tagNames are case-preserved, so the SVG `<a>` element comes through as
2121 // lowercase `a` and never matches the uppercase `badTags` entries unless we
22- // normalize first.
23- return ( tagName === null || has ( badTags , tagName . toUpperCase ( ) ) ) && has ( badAttributes , attribute ) ;
22+ // normalize first. The attribute name can likewise arrive camelCased (e.g.
23+ // `formAction`) when the template author writes it that way and it resolves to
24+ // a DOM property, so lower-case it before matching the lowercase lists.
25+ return (
26+ ( tagName === null || has ( badTags , tagName . toUpperCase ( ) ) ) &&
27+ has ( badAttributes , attribute . toLowerCase ( ) )
28+ ) ;
2429}
2530
2631function checkDataURI ( tagName : Nullable < string > , attribute : string ) : boolean {
2732 if ( tagName === null ) return false ;
28- return has ( badTagsForDataURI , tagName . toUpperCase ( ) ) && has ( badAttributesForDataURI , attribute ) ;
33+ return (
34+ has ( badTagsForDataURI , tagName . toUpperCase ( ) ) &&
35+ has ( badAttributesForDataURI , attribute . toLowerCase ( ) )
36+ ) ;
2937}
3038
3139function checkDataProtocol ( tagName : Nullable < string > , attribute : string ) : boolean {
3240 if ( tagName === null ) return false ;
3341 return (
3442 has ( badTagsForDataProtocol , tagName . toUpperCase ( ) ) &&
35- has ( badAttributesForDataProtocol , attribute )
43+ has ( badAttributesForDataProtocol , attribute . toLowerCase ( ) )
3644 ) ;
3745}
3846
0 commit comments