ElementStyler: Remove jQuery for legacyradio value setting
Continued eradication of jQuery for performance reasons. * src/ui/ElementStyler.js (setValueByName): Do not use jQuery for legacyradio styling. Throw exception on `change_event' argument set (this should no longer be used).master
parent
fa9ee5d340
commit
d0bbc04218
|
@ -452,7 +452,13 @@ module.exports = Class( 'ElementStyler',
|
|||
{
|
||||
change_event = ( change_event === undefined ) ? true : change_event;
|
||||
|
||||
var $element;
|
||||
// just to be sure before we fully remove this
|
||||
if ( change_event !== false )
|
||||
{
|
||||
throw Error(
|
||||
"ElementStyler#setValueByName change_event is being removed"
|
||||
);
|
||||
}
|
||||
|
||||
// set value
|
||||
switch ( this._getElementType( name ) )
|
||||
|
@ -486,33 +492,19 @@ module.exports = Class( 'ElementStyler',
|
|||
var i = elements.length;
|
||||
while ( i-- )
|
||||
{
|
||||
var $question = $( elements[ i ] );
|
||||
|
||||
if ( $question.attr( 'value' ) == value )
|
||||
{
|
||||
$question.attr( 'checked', true );
|
||||
$element = $question;
|
||||
}
|
||||
else
|
||||
{
|
||||
$question.attr( 'checked', false );
|
||||
}
|
||||
const question = elements[ i ];
|
||||
question.checked = ( question.value === ''+value );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$element = this.getElementByName(
|
||||
const $element = this.getElementByName(
|
||||
name, index, null, $context
|
||||
);
|
||||
$element.val( ''+( value ) );
|
||||
}
|
||||
|
||||
if ( $element && change_event )
|
||||
{
|
||||
$element.trigger( 'change' );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue