File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ var parseColor = function(c) {
5252} ;
5353
5454var getLevel = function ( c , module ) {
55- var a = module . abs ( c ) ;
55+ var a = Math . abs ( c ) ;
5656 for ( let i = 0 ; i < module . arraySize ; i ++ ) {
5757 if ( a < module . levels [ i + 1 ] ) {
5858 return i ;
@@ -84,7 +84,8 @@ var addExample = function(fg, bg) {
8484 display . style . fontWeight = font_weight ;
8585 display . style . padding = PADDING [ wcag_level ] ;
8686
87- clone . querySelector ( '.wcag output' ) . textContent = wcag_contrast . toFixed ( 1 ) ;
87+ // trunc is due to AGWG disregarding standard maths
88+ clone . querySelector ( '.wcag output' ) . textContent = Math . trunc ( wcag_contrast * 10 ) / 10 ;
8889 clone . querySelector ( '.wcag .badge' ) . textContent = LEVEL_LABELS [ wcag_level ] ;
8990 clone . querySelector ( '.wcag .badge' ) . classList . add ( `badge-${ LEVEL_LABELS [ wcag_level ] } ` ) ;
9091
You can’t perform that action at this time.
0 commit comments