browser: apply vendor prefix exceptions
[sheet.git] / browser.plp
index ad8690f2781e0d4902aae5ac8723befc5e4ae733..48bd6e587f4e100279101c6e81a036506552b7d7 100644 (file)
@@ -22,7 +22,7 @@ Html({
 
 say "<h1>Browser compatibility</h1>\n";
 
-my $caniuse = do 'data/browser/support.inc.pl' or die $! || $@;
+my $caniuse = do 'data/browser/support.inc.pl' or die $@ || $!;
 $_->{verrelease} = {
        # mark last three (future) versions as unreleased, ensure current isn't
        map {
@@ -58,7 +58,9 @@ my %DSTATS = (
        x => sub {
                join(' ',
                        'requires prefix',
-                       (map "-$_-", $caniuse->{agents}->{$_[0]}->{prefix} // ()),
+                       map {"-$_-"}
+                       ($caniuse->{agents}->{$_[0]}->{prefix_exceptions} // {})->{$_[1]}
+                       // $caniuse->{agents}->{$_[0]}->{prefix} // (),
                );
        },
 );
@@ -99,7 +101,7 @@ given ($get{usage} // 'wm') {
                        'identifier must be alphanumeric name or <q>0</q>';
        }
        $canihas = do "data/browser/usage-$_.inc.pl" or do {
-               printf "<p>Browser usage data not found: <em>%s</em>", $! || $@;
+               printf "<p>Browser usage data not found: <em>%s</em>", $@ || $!;
                break;
        };
        $usage = $_;
@@ -386,7 +388,7 @@ sub saybrowsercols {
 
                        # prepare version hover details
                        my $title = sprintf('%.1f%% %s', $usage * $usagepct, join(', ',
-                               map { ref $_ eq 'CODE' ? $_->($browser) : $_ }
+                               map { ref $_ eq 'CODE' ? $_->($browser, $span[0]->[0]) : $_ }
                                map { $DSTATS{$_} // () }
                                map { split / /, $_ }
                                $prev