1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-19 12:52:11 +01:00

Strip HTML from the aria-label tag for the sorting headers

This commit is contained in:
Allan Jardine 2012-03-14 07:04:33 +00:00
parent 74f970e1a7
commit c22dfe00d3
2 changed files with 8 additions and 6 deletions

View File

@ -3894,6 +3894,7 @@
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{ {
var sTitle = aoColumns[i].sTitle.replace( /<.*?>/g, "" );
nTh = aoColumns[i].nTh; nTh = aoColumns[i].nTh;
nTh.removeAttribute('aria-sort'); nTh.removeAttribute('aria-sort');
nTh.removeAttribute('aria-label'); nTh.removeAttribute('aria-label');
@ -3907,18 +3908,18 @@
var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ? var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ?
aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0]; aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0];
nTh.setAttribute('aria-label', aoColumns[i].sTitle+ nTh.setAttribute('aria-label', sTitle+
(nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); (nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
} }
else else
{ {
nTh.setAttribute('aria-label', aoColumns[i].sTitle+ nTh.setAttribute('aria-label', sTitle+
(aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
} }
} }
else else
{ {
nTh.setAttribute('aria-label', aoColumns[i].sTitle); nTh.setAttribute('aria-label', sTitle);
} }
} }

View File

@ -134,6 +134,7 @@ function _fnSort ( oSettings, bApplyClasses )
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{ {
var sTitle = aoColumns[i].sTitle.replace( /<.*?>/g, "" );
nTh = aoColumns[i].nTh; nTh = aoColumns[i].nTh;
nTh.removeAttribute('aria-sort'); nTh.removeAttribute('aria-sort');
nTh.removeAttribute('aria-label'); nTh.removeAttribute('aria-label');
@ -147,18 +148,18 @@ function _fnSort ( oSettings, bApplyClasses )
var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ? var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ?
aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0]; aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0];
nTh.setAttribute('aria-label', aoColumns[i].sTitle+ nTh.setAttribute('aria-label', sTitle+
(nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); (nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
} }
else else
{ {
nTh.setAttribute('aria-label', aoColumns[i].sTitle+ nTh.setAttribute('aria-label', sTitle+
(aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
} }
} }
else else
{ {
nTh.setAttribute('aria-label', aoColumns[i].sTitle); nTh.setAttribute('aria-label', sTitle);
} }
} }