Skip to content

Commit

Permalink
jQuery.textSelection: Option values of undefined revert to defaults
Browse files Browse the repository at this point in the history
Bug: T368102
Change-Id: Ie9bf594620344a4a451dae5bef91c0f2a6aca6da
  • Loading branch information
edg2s authored and MatmaRex committed Jun 21, 2024
1 parent 337140f commit 4bcb5ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/src/jquery/jquery.textSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@
$.fn.textSelection = function ( command, commandOptions ) {
var alternateFn = $( this ).data( 'jquery.textSelection' );

// Prevent values of `undefined` overwriting defaults (T368102)
for ( var key in commandOptions ) {
if ( commandOptions[ key ] === undefined ) {
delete commandOptions[ key ];
}
}

// Apply defaults
switch ( command ) {
// case 'getContents': // no params
Expand Down

0 comments on commit 4bcb5ac

Please sign in to comment.