@@ -33,20 +33,22 @@ axe.utils.aggregateChecks = function (nodeResOriginal) {
3333 } ) ;
3434
3535 // Find the result with the highest priority
36- let priorities = anyAllNone ( nodeResult , ( c ) => c . priority ) ;
37- nodeResult . priority = Math . max (
38- priorities . all . reduce ( ( a , b ) => Math . max ( a , b ) , 0 ) ,
39- priorities . none . reduce ( ( a , b ) => Math . max ( a , b ) , 0 ) ,
36+ const priorities = {
37+ all : nodeResult . all . reduce ( ( a , b ) => Math . max ( a , b . priority ) , 0 ) ,
38+ none : nodeResult . none . reduce ( ( a , b ) => Math . max ( a , b . priority ) , 0 ) ,
4039 // get the lowest passing of 'any' defaulting
4140 // to 0 by wrapping around 4 to 0 (inapplicable)
42- priorities . any . reduce ( ( a , b ) => Math . min ( a , b ) , 4 ) % 4
43- ) ;
41+ any : nodeResult . any . reduce ( ( a , b ) => Math . min ( a , b . priority ) , 4 ) % 4
42+ } ;
43+
44+ nodeResult . priority = Math . max ( priorities . all , priorities . none , priorities . any ) ;
4445
4546 // Of each type, filter out all results not matching the final priority
4647 let impacts = [ ] ;
4748 checkTypes . forEach ( ( type ) => {
4849 nodeResult [ type ] = nodeResult [ type ] . filter ( ( check ) => {
49- return check . priority === nodeResult . priority ;
50+ return ( check . priority === nodeResult . priority &&
51+ check . priority === priorities [ type ] ) ;
5052 } ) ;
5153 nodeResult [ type ] . forEach ( ( check ) => impacts . push ( check . impact ) ) ;
5254 } ) ;
0 commit comments