Core: Add namespace classname to table

This commit is contained in:
Rob Garrison 2017-05-16 14:05:50 -05:00
parent 99398e9dba
commit cbb37f8b3f

View File

@ -254,11 +254,6 @@
if ( !/tablesorter\-/.test( $table.attr( 'class' ) ) ) {
tmp = ( c.theme !== '' ? ' tablesorter-' + c.theme : '' );
}
c.table = table;
c.$table = $table
.addClass( ts.css.table + ' ' + c.tableClass + tmp )
.attr( 'role', 'grid' );
c.$headers = $table.find( c.selectorHeaders );
// give the table a unique id, which will be used in namespace binding
if ( !c.namespace ) {
@ -268,6 +263,14 @@
c.namespace = '.' + c.namespace.replace( ts.regex.nonWord, '' );
}
c.table = table;
c.$table = $table
// add namespace to table to allow bindings on extra elements to target
// the parent table (e.g. parser-input-select)
.addClass( ts.css.table + ' ' + c.tableClass + tmp + ' ' + c.namespace.slice(1) )
.attr( 'role', 'grid' );
c.$headers = $table.find( c.selectorHeaders );
c.$table.children().children( 'tr' ).attr( 'role', 'row' );
c.$tbodies = $table.children( 'tbody:not(.' + c.cssInfoBlock + ')' ).attr({
'aria-live' : 'polite',
@ -2510,6 +2513,7 @@
.unbind( ( 'mousedown mouseup keypress '.split( ' ' ).join( c.namespace + ' ' ) ).replace( ts.regex.spaces, ' ' ) );
ts.restoreHeaders( table );
$t.toggleClass( ts.css.table + ' ' + c.tableClass + ' tablesorter-' + c.theme, removeClasses === false );
$t.removeClass(c.namespace.slice(1));
// clear flag in case the plugin is initialized again
table.hasInitialized = false;
delete table.config.cache;