@@ -60,6 +60,15 @@ function assertSrcContents() {
60
60
var licenseStr = licenseSrc . substring ( 2 , licenseSrc . length - 2 ) ;
61
61
var logs = [ ] ;
62
62
63
+ // These are forbidden in IE *only in SVG* but since
64
+ // that's 99% of what we do here, we'll forbid them entirely
65
+ // until there's some HTML use case where we need them.
66
+ // (not sure what we'd do then, but we'd think of something!)
67
+ var IE_SVG_BLACK_LIST = [ 'innerHTML' , 'parentElement' , 'children' ] ;
68
+
69
+ // Forbidden in IE in any context
70
+ var IE_BLACK_LIST = [ 'classList' ] ;
71
+
63
72
glob ( combineGlobs ( [ srcGlob , libGlob ] ) , function ( err , files ) {
64
73
files . forEach ( function ( file ) {
65
74
var code = fs . readFileSync ( file , 'utf-8' ) ;
@@ -69,21 +78,18 @@ function assertSrcContents() {
69
78
falafel ( code , { onComment : comments , locations : true } , function ( node ) {
70
79
// look for .classList
71
80
if ( node . type === 'MemberExpression' ) {
72
- var parts = node . source ( ) . split ( '.' ) ;
81
+ var source = node . source ( ) ;
82
+ var parts = source . split ( '.' ) ;
73
83
var lastPart = parts [ parts . length - 1 ] ;
74
- if ( lastPart === 'classList' ) {
75
- logs . push ( file + ' : contains .classList (IE failure)' ) ;
76
- }
77
- else if ( lastPart === 'innerHTML' ) {
78
- // Note: if we do anything that's NOT in SVG, innerHTML is
79
- // OK in IE. We can cross that bridge when we get to it...
80
- logs . push ( file + ' : contains .innerHTML (IE failure in SVG)' ) ;
84
+
85
+ if ( source === 'Math.sign' ) {
86
+ logs . push ( file + ' : contains Math.sign (IE failure)' ) ;
81
87
}
82
- else if ( lastPart === 'parentElement' ) {
83
- logs . push ( file + ' : contains .parentElement (IE failure)' ) ;
88
+ else if ( IE_BLACK_LIST . indexOf ( lastPart ) !== - 1 ) {
89
+ logs . push ( file + ' : contains .' + lastPart + ' (IE failure)') ;
84
90
}
85
- else if ( node . source ( ) === 'Math.sign' ) {
86
- logs . push ( file + ' : contains Math.sign (IE failure)' ) ;
91
+ else if ( IE_SVG_BLACK_LIST . indexOf ( lastPart ) !== - 1 ) {
92
+ logs . push ( file + ' : contains .' + lastPart + ' (IE failure in SVG )') ;
87
93
}
88
94
}
89
95
} ) ;
0 commit comments