File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ use Path::Tiny qw( path );
8
8
9
9
# files that have inline <script> tags
10
10
my %skip = map { $_ => 1 } (
11
- ' root/account/profile.html' , ' root/account/turing.html' ,
12
- ' root/author.html' , ' root/wrapper.html' ,
13
- ' root/about/contributors.html' , ' root/inc/favorite.html' ,
11
+ ' root/about/contributors.html' , ' root/account/profile.html' ,
12
+ ' root/account/turing.html' , ' root/wrapper.html' ,
14
13
);
15
14
16
15
my $rule = Path::Iterator::Rule-> new;
@@ -19,7 +18,13 @@ for my $file ( $rule->all('root') ) {
19
18
my $html = path($file )-> slurp_utf8;
20
19
ok $html !~ / <style>/ , " no inline style in $file " ;
21
20
if ( not $skip {$file } ) {
22
- ok $html !~ / <script[>\s ]/ , " no inline script in $file " ;
21
+ my @script_tags = $html =~ / <script\b ([^>]*)>/ ;
22
+ my @js = grep {
23
+ / \b type="([^"]*)"/
24
+ ? ( $1 =~ / (?:j|java|emca)script/ ? 1 : () )
25
+ : 1
26
+ } @script_tags ;
27
+ ok !@js , " no inline script in $file " ;
23
28
}
24
29
}
25
30
You can’t perform that action at this time.
0 commit comments