Pager: set ariaDisabled property to stop Edge crash. Fixes #1303

This commit is contained in:
Rob Garrison 2016-11-26 09:57:00 -06:00
parent 12cde473d3
commit 4053331c13
2 changed files with 27 additions and 17 deletions

View File

@ -128,16 +128,25 @@
// hide arrows at extremes
pagerArrows = function( table, p, disable ) {
var a = 'addClass',
r = 'removeClass',
d = p.cssDisabled,
dis = !!disable,
first = ( dis || p.page === 0 ),
tp = getTotalPages( table, p ),
last = ( dis || (p.page === tp - 1) || tp === 0 );
var tmp,
a = 'addClass',
r = 'removeClass',
d = p.cssDisabled,
dis = !!disable,
first = ( dis || p.page === 0 ),
tp = getTotalPages( table, p ),
last = ( dis || (p.page === tp - 1) || tp === 0 );
if ( p.updateArrows ) {
p.$container.find(p.cssFirst + ',' + p.cssPrev)[ first ? a : r ](d).attr('aria-disabled', first);
p.$container.find(p.cssNext + ',' + p.cssLast)[ last ? a : r ](d).attr('aria-disabled', last);
tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev);
tmp[ first ? a : r ](d); // toggle disabled class
tmp.each(function(){
this.ariaDisabled = first;
});
tmp = p.$container.find(p.cssNext + ',' + p.cssLast)
tmp[ last ? a : r ](d)
tmp.each(function(){
this.ariaDisabled = last;
});
}
},
@ -689,9 +698,8 @@
.add( p.$container.find( '.ts-startRow, .ts-page' ) );
len = $controls.length;
for ( index = 0; index < len; index++ ) {
$controls.eq( index )
.attr( 'aria-disabled', 'true' )
.addClass( p.cssDisabled )[0].disabled = true;
$controls.eq( index ).addClass( p.cssDisabled )[0].disabled = true;
$controls[ index ].ariaDisabled = true;
}
},
@ -876,7 +884,9 @@
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page'))
.removeClass(p.cssDisabled)
.removeAttr('disabled')
.attr('aria-disabled', 'false');
.each(function(){
this.ariaDisabled = false;
});
p.isDisabled = false;
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
size = p.$size.find('option[selected]').val();

View File

@ -404,11 +404,11 @@
p.$container
.find( s.first + ',' + s.prev )
.toggleClass( wo.pager_css.disabled, first )
.attr( 'aria-disabled', first );
.prop( 'aria-disabled', first );
p.$container
.find( s.next + ',' + s.last )
.toggleClass( wo.pager_css.disabled, last )
.attr( 'aria-disabled', last );
.prop( 'aria-disabled', last );
}
},
@ -451,7 +451,7 @@
.add( p.$goto )
.removeClass( wo.pager_css.disabled )
.removeAttr( 'disabled' )
.attr( 'aria-disabled', 'false' );
.prop( 'aria-disabled', 'false' );
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method
c.totalRows = p.totalRows;
tsp.parsePageNumber( c, p );
@ -1012,7 +1012,7 @@
len = $controls.length;
for ( index = 0; index < len; index++ ) {
$controls.eq( index )
.attr( 'aria-disabled', 'true' )
.prop( 'aria-disabled', 'true' )
.addClass( wo.pager_css.disabled )[ 0 ].disabled = true;
}
},