N°3817 - Audit and fix calls to deprecated jQuery method

This commit is contained in:
Anne-Cath
2025-08-06 19:47:57 +02:00
parent 1667f834b9
commit 5b9e0a1d4f
66 changed files with 188 additions and 211 deletions

View File

@@ -55,11 +55,11 @@ const CombodoCKEditorHandler = {
// Adjust size if passed in configuration
// - Width
if (aConfiguration.width !== undefined) {
editor.editing.view.change( writer => { writer.setStyle( 'width', aConfiguration.width, editor.editing.view.document.getRoot() ); } );
editor.editing.view.on('change', writer => { writer.setStyle( 'width', aConfiguration.width, editor.editing.view.document.getRoot() ); } );
}
// - Height
if (aConfiguration.height !== undefined) {
editor.editing.view.change( writer => { writer.setStyle( 'height', aConfiguration.height, editor.editing.view.document.getRoot() ); } );
editor.editing.view.on('change', writer => { writer.setStyle( 'height', aConfiguration.height, editor.editing.view.document.getRoot() ); } );
}
this.instances[sElem] = editor;

View File

@@ -24,11 +24,11 @@ $('body').on('enter_loading_state.button_group.itop', '[data-role="ibo-button-gr
$(this).find('[data-role="ibo-button"]').each(function(){
$(this).prop('disabled', true);
});
$(this).find('[data-role="ibo-button"]:first').trigger('enter_loading_state.button.itop');
$(this).find('[data-role="ibo-button"]').first().trigger('enter_loading_state.button.itop');
})
.on('leave_loading_state.button_group.itop', '[data-role="ibo-button-group"]', function(){
$(this).find('[data-role="ibo-button"]').each(function(){
$(this).prop('disabled', false);
});
$(this).find('[data-role="ibo-button"]:first').trigger('leave_loading_state.button.itop');
$(this).find('[data-role="ibo-button"]').first().trigger('leave_loading_state.button.itop');
});

View File

@@ -63,7 +63,7 @@ $(function () {
let $listLink = $eventTarget
.closest(this.js_selectors.dashlet_container)
.find(this.js_selectors.dashlet_action_list);
$listLink[0].click();
$listLink[0].trigger('click');
}
})
});

View File

@@ -41,11 +41,11 @@ $(function () {
fullscreen_elements: '.ibo-is-fullscreen',
},
block: {
panel_header: '[data-role="ibo-panel--header"]:first',
panel_header_sticky_sentinel_top: '[data-role="ibo-panel--header--sticky-sentinel-top"]:first',
panel_body: '[data-role="ibo-panel--body"]:first',
tab_container: '[data-role="ibo-tab-container"]:first',
tab_container_tabs_list: '[data-role="ibo-tab-container--tabs-list"]:first',
panel_header: '[data-role="ibo-panel--header"]',
panel_header_sticky_sentinel_top: '[data-role="ibo-panel--header--sticky-sentinel-top"]',
panel_body: '[data-role="ibo-panel--body"]',
tab_container: '[data-role="ibo-tab-container"]',
tab_container_tabs_list: '[data-role="ibo-tab-container--tabs-list"]',
}
},
// {ScrollMagic.Controller} SM controller for the sticky header
@@ -127,10 +127,10 @@ $(function () {
let oSMScene = new ScrollMagic.Scene({
// Traduction: As soon as the header's top sentinel...
triggerElement: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top)[0],
triggerElement: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first(),
// ... leaves the viewport...
triggerHook: 0,
offset: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).outerHeight()
offset: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first().outerHeight()
})
// ... we consider the header as sticking...
.on('enter', function () {
@@ -151,18 +151,18 @@ $(function () {
.addTo(this.sticky_header_controller);
},
_onHeaderBecomesSticky: function () {
this.element.find(this.js_selectors.block.panel_header).addClass(this.css_classes.is_sticking);
this.element.find(this.js_selectors.block.panel_header).first().addClass(this.css_classes.is_sticking);
if (this._hasTabContainer()) {
this._updateTabsListPosition(false /* Need to wait for the header transition to end */);
}
},
_onHeaderStopsBeingSticky: function () {
const fPanelBottomPosition = this.element.position().top + this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).outerHeight();
const fPanelBottomPosition = this.element.position().top + this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first().outerHeight();
const fViewportVerticalScrollPosition = this.options.viewport_elem.scrollHeight - this.options.viewport_elem.clientHeight;
// Test to prevent the screen from flashing (cf bug 4124)
if (fPanelBottomPosition < fViewportVerticalScrollPosition) {
this.element.find(this.js_selectors.block.panel_header).removeClass(this.css_classes.is_sticking);
this.element.find(this.js_selectors.block.panel_header).first().removeClass(this.css_classes.is_sticking);
if (this._hasTabContainer()) {
this._updateTabsListPosition(false /* Need to wait for the header transition to end */);
}
@@ -181,17 +181,17 @@ $(function () {
}
const me = this;
const oTabsListElem = this.element.find(this.js_selectors.block.tab_container_tabs_list);
const oTabsListElem = this.element.find(this.js_selectors.block.tab_container_tabs_list).first();
if(this._isHeaderSticking()){
// Unfortunately for now the timeout is hardcoded as we don't know how to get notified when the *CSS* transition is done.
const iTimeout = bImmediate ? 0 : 300;
setTimeout(function(){
const oHeaderElem = me.element.find(me.js_selectors.block.panel_header);
const oHeaderElem = me.element.find(me.js_selectors.block.panel_header).first();
const oHeaderOffset = oHeaderElem.offset();
const iHeaderWidth = oHeaderElem.outerWidth();
const iHeaderHeight = oHeaderElem.outerHeight();
const iPanelBorderWidth = parseInt(me.element.find(me.js_selectors.block.panel_body).css('border-left-width'));
const iPanelBorderWidth = parseInt(me.element.find(me.js_selectors.block.panel_body).first().css('border-left-width'));
oTabsListElem
.css('top', oHeaderOffset.top + iHeaderHeight)
@@ -222,7 +222,7 @@ $(function () {
* @private
*/
_isHeaderSticking: function () {
return this.element.find(this.js_selectors.block.panel_header).hasClass(this.css_classes.is_sticking);
return this.element.find(this.js_selectors.block.panel_header).first().hasClass(this.css_classes.is_sticking);
},
/**
* @return {boolean} True if the panel has a tab container
@@ -239,7 +239,7 @@ $(function () {
if(!this._hasTabContainer()) {
return false;
}
return this.element.find(this.js_selectors.block.tab_container).hasClass(this.css_classes.is_vertical);
return this.element.find(this.js_selectors.block.tab_container).first().hasClass(this.css_classes.is_vertical);
},
});
});

View File

@@ -462,7 +462,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
if (dlg.height() > ($(window).height()-70)) {
dlg.height($(window).height()-70);
}
var searchForm = dlg.find('div.display_block:first'); // Top search form, enclosing display_block
var searchForm = dlg.find('div.display_block').first(); // Top search form, enclosing display_block
var results = $('#dr_'+me.id);
var oPadding = {};
var aKeys = ['top', 'right', 'bottom', 'left'];
@@ -591,9 +591,9 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
}
if ($('#label_'+me.id).length) {
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
} else {
$('#'+me.id).focus();
$('#'+me.id).trigger('focus');
}
me.ajax_request = null;
@@ -633,7 +633,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
$('#dr_'+me.id).html(me.emptyHtml);
}
$('#label_'+me.id).removeClass('ac_dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
};
@@ -749,7 +749,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
} else {
$('#label_'+me.id).removeClass('ac_dlg_loading');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
$('#ac_create_'+me.id).dialog("destroy");
$('#ac_create_'+me.id).remove();
$('#ajax_'+me.id).html('');
@@ -820,7 +820,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
$('#label_'+me.id).val(txt);
$('#label_'+me.id).data('selected_value',txt);
$('#label_'+me.id).removeClass('ac_dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
}
$('#'+me.id).trigger('validate');
$('#'+me.id).trigger('extkeychange');
@@ -909,7 +909,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
} else {
$('#label_'+me.id).removeClass('ac_dlg_loading');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
$('#dlg_tree_'+me.id).dialog("destroy");
$('#dlg_tree_'+me.id).remove();
};
@@ -959,7 +959,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
});
$('#'+me.id).multiselect('refresh');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
},
'json'

View File

@@ -53,16 +53,16 @@ $(function()
.addClass('field_set');
this.element
.bind('field_change', function(oEvent, oData){
.on('field_change', function(oEvent, oData){
me._onFieldChange(oEvent, oData);
})
.bind('update_form', function(oEvent, oData){
.on('update_form', function(oEvent, oData){
me._onUpdateForm(oEvent, oData);
})
.bind('get_current_values', function(oEvent, oData){
.on('get_current_values', function(oEvent, oData){
return me._onGetCurrentValues(oEvent, oData);
})
.bind('validate', function(oEvent, oData){
.on('validate', function(oEvent, oData){
if (oData === undefined)
{
oData = {};

View File

@@ -24,12 +24,12 @@ $(function()
this.element.addClass('form_field');
this.element
.bind('set_validators', function(oEvent, oData){
.on('set_validators', function(oEvent, oData){
oEvent.stopPropagation();
me.options.validators = oData;
});
this.element
.bind('validate get_current_value set_current_value', function(oEvent, oData){
.on('validate get_current_value set_current_value', function(oEvent, oData){
oEvent.stopPropagation();
var callback = me.options[oEvent.type+'_callback'];
@@ -131,7 +131,7 @@ $(function()
var bMandatory = (this.options.validators.mandatory !== undefined);
var bNotEmptyExtKey = (this.options.validators.notemptyextkey !== undefined);
var bEmpty = ($.isArray(oValue)) ? (oValue.length === 0) : (oValue === '' || oValue === undefined);
var bEmpty = (Array.isArray(oValue)) ? (oValue.length === 0) : (oValue === '' || oValue === undefined);
var value = oValue;
// This is just a safety check in case a field doesn't always return an object when no value assigned, so we have to check the mandatory validator here...
@@ -167,7 +167,7 @@ $(function()
oResult.error_messages.push(oValidator.message);
}
// ... In case of non empty array, we have to check if the value is not null
else if($.isArray(value))
else if(Array.isArray(value))
{
for(var i in value)
{
@@ -215,7 +215,7 @@ $(function()
oResult.error_messages.push(oValidator.message);
}
}
else if($.isArray(value))
else if(Array.isArray(value))
{
for(var i in value)
{

View File

@@ -45,10 +45,10 @@ $(function()
.addClass('form_handler');
// Binding events
this.element.bind('update_fields', function(oEvent, oData){
this.element.on('update_fields', function(oEvent, oData){
me._onUpdateFields(oEvent, oData);
});
this.element.bind('fields_touched', function(oEvent){
this.element.on('fields_touched', function(oEvent){
me._onFieldsTouched(oEvent);
});

View File

@@ -183,7 +183,7 @@ function CheckFields(sFormId, bDisplayAlert)
$('#'+sFormId+' :submit').prop('disable', false);
$('#'+sFormId+' :button[type=submit]').prop('disable', false);
if (oFormErrors['input_'+sFormId] != null) {
$('#'+oFormErrors['input_'+sFormId]).focus();
$('#'+oFormErrors['input_'+sFormId]).trigger('focus');
}
}

View File

@@ -537,7 +537,7 @@
// Simple key, even simpler rules, since only scalars and shallow
// arrays are allowed.
if ( $.isArray( obj[key] ) ) {
if ( Array.isArray( obj[key] ) ) {
// val is already an array, so push on the next value.
obj[key].push( val );
@@ -895,7 +895,7 @@
// For each passed key, delete the corresponding property from the current
// state.
$.each( $.isArray( arr ) ? arr : arguments, function(i,v){
$.each( Array.isArray( arr ) ? arr : arguments, function(i,v){
delete state[ v ];
});
}
@@ -905,6 +905,7 @@
};
// Event: hashchange event (BBQ)
//
// Usage in jQuery 1.4 and newer:
//
@@ -978,7 +979,7 @@
// This may seem a little complicated, but it normalizes the special event
// .add method between jQuery 1.4/1.4.1 and 1.4.2+
if ( $.isFunction( handleObj ) ) {
if ( typeof ( handleObj ) === 'function' ) {
// 1.4, 1.4.1
old_handler = handleObj;
return new_handler;

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@
var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0;
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
var setExpr = (typeof (document.createElement('div').style.setExpression) === 'function');
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };

View File

@@ -159,7 +159,7 @@
restoreTextSelection();
// persist state if necessary
if (_this.options.persistState !== null) {
$.isFunction(_this.options.persistState) ? _this.options.persistState(_this.originalTable) : _this.persistState();
(typeof( _this.options.persistState) === 'function') ? _this.options.persistState(_this.originalTable) : _this.persistState();
}
};
},
@@ -330,7 +330,7 @@
}
// restore state if necessary
if (this.options.restoreState !== null) {
$.isFunction(this.options.restoreState) ? this.options.restoreState(this.originalTable) : this._restoreState(this.options.restoreState);
(typeof( _this.options.restoreState) === 'function') ? this.options.restoreState(this.originalTable) : this._restoreState(this.options.restoreState);
}
var _this = this;
this.bindTo.mousedown(function(evt) {
@@ -354,7 +354,7 @@
this._create();
},
destroy: function() {
this.bindTo.unbind('mousedown');
this.bindTo.off('mousedown');
$.Widget.prototype.destroy.apply(this, arguments); // default destroy
// now do other stuff particular to this widget
}

View File

@@ -110,7 +110,7 @@ $.widget('itop.set_widget',
var dataArray = JSON.parse(originalFieldValue),
setWidget = this;
this.possibleValues = dataArray[this.POSSIBLE_VAL_KEY];
this.partialValues = ($.isArray(dataArray[this.PARTIAL_VAL_KEY])) ? dataArray[this.PARTIAL_VAL_KEY] : [];
this.partialValues = (Array.isArray(dataArray[this.PARTIAL_VAL_KEY])) ? dataArray[this.PARTIAL_VAL_KEY] : [];
this.originalValue = dataArray[this.ORIG_VAL_KEY];
this.maxItemsAllowed = dataArray[this.MAX_ITEMS_ALLOWED_KEY];
this.setItemsCodesStatus = {};
@@ -176,7 +176,7 @@ $.widget('itop.set_widget',
_bindEvents: function($widgetElement) {
var setWidget = this;
$widgetElement.bind("update", function() {
$widgetElement.on("update", function() {
if (setWidget.options.isDebug) {
console.debug("update event in Selectize !", this);
}

View File

@@ -222,7 +222,7 @@
if(numChecked === 0) {
value = o.noneSelectedText;
} else {
if($.isFunction(o.selectedText)) {
if(typeof o.selectedText === 'function') {
value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get());
} else if(/\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList) {
value = $checked.map(function() { return $(this).next().html(); }).get().join(', ');

View File

@@ -14,7 +14,7 @@ jQuery.fn.popupmenu = function ()
var popupmenu = null;
return this.each(function()
{
$(this).bind('click.popup_menu', function (evt)
$(this).on('click.popup_menu', function (evt)
{
var previous_popup = popupmenu;
var bMenuClosed = false;
@@ -58,7 +58,7 @@ jQuery.fn.popupmenu = function ()
evt.stopPropagation();
});
$(document).bind('click.popup_menu', function(evt)
$(document).on('click.popup_menu', function(evt)
{
if (popupmenu)
{

View File

@@ -367,7 +367,7 @@ $(function()
oEvent.stopImmediatePropagation();
// Simulate click on the only menu item
this.element.find(this.js_selectors.compose_menu_item+':first').trigger('click');
this.element.find(this.js_selectors.compose_menu_item).first().trigger('click');
}
// Else, the compose menu will open automatically
@@ -1550,7 +1550,7 @@ $(function()
*/
_CreateEntryGroup: function (sAuthorLogin, sOrigin, sPosition = 'start') {
// Note: When using the ActivityPanel, there should always be at least one entry group already, the one from the object creation
let oEntryGroupElem = this.element.find(this.js_selectors.entry_group+':first')
let oEntryGroupElem = this.element.find(this.js_selectors.entry_group).first()
.clone()
.attr('data-entry-author-login', sAuthorLogin)
.attr('data-entry-group-origin', sOrigin)

View File

@@ -179,7 +179,7 @@ $(function() {
});
// Set focus in the input
this.element.on('set_focus.caselog_entry_form.itop', function () {
CKEditorInstance.focus();
CKEditorInstance.trigger('focus');
});
},

View File

@@ -150,7 +150,7 @@ $(function()
{
if(this._getActiveMenuGroupId() === null)
{
const sFirstMenuGroupId = this.element.find(this.js_selectors.menu_group+':first').attr('data-menu-group-id');
const sFirstMenuGroupId = this.element.find(this.js_selectors.menu_group).first().attr('data-menu-group-id');
this._openDrawer(sFirstMenuGroupId);
}
@@ -310,7 +310,7 @@ $(function()
// Show matching menu node
this.element.find('[data-role="ibo-navigation-menu--menu-node"]').each(function () {
// Note: We don't filter on data-role="ibo-navigation-menu--menu-node-label" on purpose so we can also filter the counters
const sNodeValue = me._formatValueForFilterComparison($(this).children('[data-role="ibo-navigation-menu--menu-node-title"]:first').text());
const sNodeValue = me._formatValueForFilterComparison($(this).children('[data-role="ibo-navigation-menu--menu-node-title"]').first().text());
let bMatches = true;
// On first non matching part, we consider that the menu node is not a match

View File

@@ -41,7 +41,7 @@ $(function()
// Keep URL's hash parameters when clicking on a link of the header
// Note: ":first" used to only target the header of the object, not what could be in the content of its body
this.element.on('click', '[data-role="ibo-panel--header-right"]:first a', function() {
this.element.find('[data-role="ibo-panel--header-right"]').first().on('click', 'a', function() {
aMatches = /#(.*)$/.exec(window.location.href);
if (aMatches != null) {
currentHash = aMatches[1];
@@ -68,7 +68,7 @@ $(function()
}
// Check if transitions available
const oHeaderElem = this.element.find('[data-role="ibo-panel--header"]:first');
const oHeaderElem = this.element.find('[data-role="ibo-panel--header"]').first();
const oButtonsToolbarElem = oHeaderElem.find('[data-role="ibo-panel--header-right"] [data-role="ibo-toolbar"]');
const oTransitionButtonsElems = oButtonsToolbarElem.find('[name="next_action"][data-role="ibo-button"]');
if (oHeaderElem.find('[name="next_action"][data-role="ibo-button"]').length === 0) {

View File

@@ -43,7 +43,7 @@ $.widget( "itop.regulartabs", $.ui.tabs, {
// the body anyway.
.on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
this.trigger('blur');
}
} );

View File

@@ -14,7 +14,7 @@ $.widget( "itop.scrollabletabs", $.ui.tabs, {
panel.prepend('<div class="ibo-tab-container--tab-container--label"><span>' + tab.text() + '</span></div>');
let oTempDiv = $('<div>').addClass('ibo-tab--temporary-remote-content')
let oPlaceholder = $('<div>').addClass('ibo-tab--temporary-remote-content--placeholder').load(tab.attr('data-placeholder'));
let oLoadButton = $('<div>').addClass('ibo-tab--temporary-remote-content--button').text(placeholder).on('click', function(){tab.find('a').click()})
let oLoadButton = $('<div>').addClass('ibo-tab--temporary-remote-content--button').text(placeholder).on('click', function(){tab.find('a').trigger('click')})
oTempDiv.append(oPlaceholder)
oTempDiv.append(oLoadButton)
panel.append(oTempDiv);

View File

@@ -121,7 +121,7 @@ $(function()
/*
this.datatable.trigger("update").trigger("applyWidgets");
this.datatable.tableHover();*/
this.datatable.find('.selectList'+this.id).bind('change', function () {
this.datatable.find('.selectList'+this.id).on('change', function () {
me._updateButtons();
});
@@ -202,7 +202,7 @@ $(function()
me.oDlg = $('<div></div>');
$('body').append(me.oDlg);
me.oDlg.html(data);
me.oDlg.find('form').removeAttr('onsubmit').bind('submit', function () {
me.oDlg.find('form').removeAttr('onsubmit').on('submit', function () {
me._onSearchToAdd();
return false;
});
@@ -429,7 +429,7 @@ $(function()
me.oDlg.find('span.indicator').html('<img src="../images/indicator.gif">');
$.post(this.options.submit_to, oParams, function (data) {
me.oDlg.html(data);
me.oDlg.find('form').removeAttr('onsubmit').bind('submit', function () {
me.oDlg.find('form').removeAttr('onsubmit').on('submit', function () {
me._onCreateRow();
return false;
});

View File

@@ -260,7 +260,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
theMap[this.name] = this.value;
}
}
$(this).parents('tr:first').remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
$(this).parents('tr').first().remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
}
);
@@ -342,7 +342,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
}
width = dlg.innerWidth()-padding_right-padding_left-22; // 5 (margin-left) + 5 (padding-left) + 5 (padding-right) + 5 (margin-right) + 2 for rounding !
height = dlg.innerHeight()-padding_top-padding_bottom-22;
wizard = dlg.find('.wizContainer:first');
wizard = dlg.find('.wizContainer').first();
wizard.width(width);
wizard.height(height);
form_height = searchForm.outerHeight();

View File

@@ -226,7 +226,7 @@ $(function()
// Focus on right input
var oOpElemRadioChecked = this.element.find('.sfc_fg_operator .sfc_op_radio:checked');
var oOpElemInputFirst = oOpElemRadioChecked.closest('.sfc_fg_operator').find('.sfc_op_content input[type="text"]:first');
var oOpElemInputFirst = oOpElemRadioChecked.closest('.sfc_fg_operator').find('.sfc_op_content input[type="text"]').first();
oOpElemInputFirst.filter(':not([data-no-auto-focus])').trigger('click').trigger('focus');
@@ -656,7 +656,7 @@ $(function()
if ($(oEvent.target).is('input[type="text"], select')) {
return;
}
oOpContentElem.focus();
oOpContentElem.trigger('focus');
});
// - Mark as draft on key typing
oOpContentElem.on('keydown', function(oEvent){

View File

@@ -230,7 +230,7 @@ $(function()
var odatetimepickerOptions = $.extend({}, oInputParam.picker_extra_params, odatetimepickerOptionsDefault, me.options.datepicker, {
onSelect: function() {
fHandleSynchCallback(this, false);
$(this).focus();
$(this).trigger('focus');
}
});
@@ -581,7 +581,7 @@ $(function()
oOpElemDropdown.find('.sfc_op_radio').prop('checked', true);
me._markAsDraft();
}
oOpElemDropdown.find('input[type="text"]:first').focus();
oOpElemDropdown.find('input[type="text"]').first().trigger('focus');
})
.appendTo(this.element.find('.sfc_fg_operators'))
;

View File

@@ -129,7 +129,7 @@ $(function()
if ($(oEvent.target).is('input[type="text"], select')) {
return;
}
oOpContentElemFrom.focus();
oOpContentElemFrom.trigger('focus');
});
// - Apply on "enter" key hit
// TODO: this could be refactored

View File

@@ -319,9 +319,9 @@ $(function()
// - Open it first
this.elements.more_criterion.addClass('opened');
// - Focus filter
this.elements.more_criterion.find('.sf_filter:first input[type="text"]')
this.elements.more_criterion.find('.sf_filter').first().find('input[type="text"]')
.val('')
.focus();
.trigger('focus');
// - Then only check if more menu is to close to the right side (otherwise we might not have the right element's position)
var iFormWidth = this.element.outerWidth();
var iFormLeftPos = this.element.offset().left;
@@ -436,7 +436,7 @@ $(function()
// DOM
this.elements.more_criterion = $('<div></div>')
.addClass('sf_more_criterion')
.appendTo(this.elements.criterion_area.find('.sf_criterion_row:first'));
.appendTo(this.elements.criterion_area.find('.sf_criterion_row').first());
// Header part
var oHeaderElem = $('<div class="sfm_header"></div>')
@@ -705,7 +705,7 @@ $(function()
this.elements.submit_button = $('<div></div>')
.addClass('sf_button')
.addClass('sf_submit')
.appendTo(this.elements.criterion_area.find('.sf_criterion_row:first'));
.appendTo(this.elements.criterion_area.find('.sf_criterion_row').first());
var sButtonText = (this.options.auto_submit === true) ? Dict.S('UI:Button:Refresh') : Dict.S('UI:Button:Search');
var sButtonIcon = (this.options.auto_submit === true) ? 'fas fa-sync-alt' : 'fas fa-search';
@@ -871,7 +871,7 @@ $(function()
// Add to first OR condition if not specified
if(oCriterionGroupElem === undefined)
{
oCriterionGroupElem = this.elements.criterion_area.find('.sf_criterion_row:first .sf_criterion_group');
oCriterionGroupElem = this.elements.criterion_area.find('.sf_criterion_row').first().find('.sf_criterion_group');
}
// Protection against bad initialization data
@@ -1209,7 +1209,7 @@ $(function()
{
const me = this;
const oFormPanelHeaderElem = this._getFormPanelHeaderElem();
const oResultsPanelBodyElem = this._getResultsPanelElem().find('.ibo-panel--body:first');
const oResultsPanelBodyElem = this._getResultsPanelElem().find('.ibo-panel--body').first();
// Ensure result body panel has been created
if (oResultsPanelBodyElem.length === 0) {
@@ -1418,7 +1418,7 @@ $(function()
return null;
}
return oFormPanelElem.find('[data-role="ibo-panel--header"]:first');
return oFormPanelElem.find('[data-role="ibo-panel--header"]').first();
},
/**
* @return {null|Object} The jQuery object representing the body of the search form panel; or null if none found
@@ -1431,7 +1431,7 @@ $(function()
return null;
}
return oFormPanelElem.find('[data-role="ibo-panel--body"]:first');
return oFormPanelElem.find('[data-role="ibo-panel--body"]').first();
},
/**
* @return {Object} The jQuery object representing the complete results panel
@@ -1439,7 +1439,7 @@ $(function()
*/
_getResultsPanelElem: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('[data-role="ibo-panel"]:first')
return this.elements.results_area === null ? null : this.elements.results_area.find('[data-role="ibo-panel"]').first();
},
/**
* @return {Object} The jQuery object representing the top toolbar of the results (pagination, ...)
@@ -1447,7 +1447,7 @@ $(function()
*/
_getResultsToolbarTopElem: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('.ibo-datatable--toolbar:first');
return this.elements.results_area === null ? null : this.elements.results_area.find('.ibo-datatable--toolbar').first();
},
/**
* @return {Object} The jQuery object representing the columns headers of the results
@@ -1455,7 +1455,7 @@ $(function()
*/
_getResultsTableHeaders: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('.dataTables_scrollHead:first');
return this.elements.results_area === null ? null : this.elements.results_area.find('.dataTables_scrollHead').first();
},

View File

@@ -129,7 +129,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
{
dlg.height($(window).height()-70);
}
var searchForm = dlg.find('div.display_block:first'); // Top search form, enclosing display_block
var searchForm = dlg.find('div.display_block').first(); // Top search form, enclosing display_block
var results = $('#SearchResultsToAdd_'+me.id);
var oPadding = {};
var aKeys = ['top', 'right', 'bottom', 'left'];
@@ -257,7 +257,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
theMap[this.name] = this.value;
}
}
$(this).parents('tr:first').remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
$(this).parents('tr').first().remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
}
);
theMap["sFilter"] = $('#datatable_ResultsToAdd_'+me.id+' [name="filter"]').val();
@@ -300,7 +300,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
$('#SearchResultsToAdd_'+me.id).html(me.emptyHtml);
}
$('#label_'+me.id).removeClass('dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
};

View File

@@ -118,7 +118,7 @@ MicroPlugin.mixin = function (Interface) {
loaded: {}
};
if (isArray(plugins)) {
if (Array.isArray(plugins)) {
for (i = 0, n = plugins.length; i < n; i++) {
if (typeof plugins[i] === 'string') {
queue.push(plugins[i]);
@@ -665,7 +665,7 @@ var getInputSelection = function (input) {
result.start = input.selectionStart;
result.length = input.selectionEnd - result.start;
} else if (document.selection) {
input.focus();
input.trigger('focus');
var sel = document.selection.createRange();
var selLen = document.selection.createRange().text.length;
sel.moveStart('character', -input.value.length);
@@ -830,7 +830,7 @@ var Selectize = function($input, settings) {
var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
dir = dir || $input.parents('[dir]:first').attr('dir') || '';
dir = dir || $input.parents('[dir]').first().attr('dir') || '';
self.settings = {};
@@ -1180,7 +1180,7 @@ $.extend(Selectize.prototype, {
}
if (!self.isFocused || !self.isOpen) {
self.focus();
self.trigger('focus');
e.preventDefault();
}
},
@@ -1194,7 +1194,7 @@ $.extend(Selectize.prototype, {
if (!defaultPrevented) {
window.setTimeout(function () {
if (!self.isOpen) {
self.focus();
self.trigger('focus');
}
}, 0);
}
@@ -1377,7 +1377,7 @@ $.extend(Selectize.prototype, {
var wasFocused = self.isFocused;
if (self.isDisabled) {
self.blur();
self.trigger('blur');
e && e.preventDefault();
return false;
}
@@ -1415,7 +1415,7 @@ $.extend(Selectize.prototype, {
self.setCaret(self.items.length);
self.refreshState();
dest && dest.focus && dest.focus();
dest && dest.focus && dest.trigger('focus');
self.isBlurring = false;
self.ignoreFocus = false;
@@ -1589,7 +1589,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
if (!this.isFocused) {
self.focus();
self.trigger('focus');
}
},
@@ -1637,7 +1637,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
self.close();
}
self.focus();
self.trigger('focus');
},
hideInput: function() {
@@ -1658,7 +1658,7 @@ $.extend(Selectize.prototype, {
if (self.isDisabled) return self;
self.ignoreFocus = true;
self.$control_input[0].focus();
self.$control_input[0].trigger('focus');
window.setTimeout(function() {
self.ignoreFocus = false;
self.onFocus();
@@ -1667,7 +1667,7 @@ $.extend(Selectize.prototype, {
},
blur: function(dest) {
this.$control_input[0].blur();
this.$control_input[0].trigger('blur');
this.onBlur(null, dest);
return this;
},
@@ -1837,17 +1837,17 @@ $.extend(Selectize.prototype, {
if (results.items.length > 0) {
$active_before = active_before && self.getOption(active_before);
if (results.query !== "" && self.settings.setFirstOptionActive) {
$active = $dropdown_content.find('[data-selectable]:first')
$active = $dropdown_content.find('[data-selectable]').first();
} else if (results.query !== "" && $active_before && $active_before.length) {
$active = $active_before;
$active = $active_before;
} else if (self.settings.mode === 'single' && self.items.length) {
$active = self.getOption(self.items[0]);
$active = self.getOption(self.items[0]);
}
if (!$active || !$active.length) {
if ($create && !self.settings.addPrecedence) {
$active = self.getAdjacentOption($create, 1);
} else {
$active = $dropdown_content.find('[data-selectable]:first');
$active = $dropdown_content.find('[data-selectable]').first();
}
}
} else {
@@ -2350,7 +2350,7 @@ $.extend(Selectize.prototype, {
(self.settings.mode === "multi" && self.isFull())
)
return;
self.focus();
self.trigger('focus');
self.isOpen = true;
self.refreshState();
self.$dropdown.css({ visibility: 'hidden', display: 'block' });
@@ -2368,7 +2368,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
if (self.isBlurring) {
self.$control_input[0].blur();
self.$control_input[0].trigger('blur');
}
}

View File

@@ -86,13 +86,13 @@ $(function()
me._on_tabs_activate(ui);
});
}
$(window).bind('resized', function () {
$(window).on('resized', function () {
var that = me;
window.setTimeout(function () {
that._on_resize();
}, 50);
});
$('#dh_flash').bind('toggle_complete', function () {
$('#dh_flash').on('toggle_complete', function () {
var that = me;
window.setTimeout(function () {
that._on_resize();
@@ -655,7 +655,7 @@ $(function()
close: function() { $(this).remove(); },
buttons: [
{text: this.options.labels['cancel'], click: function() { $(this).dialog('close');} },
{text: this.options.labels['export'], click: function() { $('#graph_'+me.element.attr('id')+'_export_dlg').submit(); $(this).dialog('close');} },
{text: this.options.labels['export'], click: function() { $('#graph_'+me.element.attr('id')+'_export_dlg').trigger('submit'); $(this).dialog('close');} },
]
});
},

View File

@@ -47,7 +47,7 @@ $(document).ready(function () {
if (($cellClickedInput.length === 1)
&& ($cellClickedInput.is("input:radio") || $cellClickedInput.is("input:checkbox"))
) {
$cellClickedInput.click();
$cellClickedInput.trigger('click');
if ($cellClicked.not(":first-child")) {
return;
@@ -56,7 +56,7 @@ $(document).ready(function () {
var $lineClicked = $eventTarget.closest("tr");
var $lineClickedInput = $lineClicked.find(FIRST_CELL_WITH_INPUT_SELECTOR);
$lineClickedInput.click();
$lineClickedInput.trigger('click');
});
$(document).on('change', TABLE_SELECTOR, function (event) {

View File

@@ -33,7 +33,7 @@ function ReloadTruncatedList(divId, sSerializedFilter, sExtraParams) {
var table = $(this);
var id = $(this).parent();
aTruncatedLists[divId] = undefined;
var checkbox = (table.find('th:first :checkbox').length > 0);
var checkbox = (table.find('th').first().find(':checkbox').length > 0);
if (checkbox) {
// There is a checkbox in the first column, don't make it sortable
table.tablesorter({headers: {0: {sorter: false}}, widgets: ['myZebra', 'truncatedList']}).tablesorterPager({container: $("#pager")}); // sortable and zebra tables
@@ -387,7 +387,7 @@ function OpenOql(sOQL) {
form.appendChild(input);
document.body.appendChild(form);
// form.submit() is blocked by the browser
$('#run_query_form').submit();
$('#run_query_form').trigger('submit');
document.body.removeChild(form);
}
@@ -1397,7 +1397,7 @@ let CombodoModal = {
let oSelectorElem = null;
switch(typeof oOptions.base_modal.selector) {
case 'string':
oSelectorElem = $(oOptions.base_modal.selector);
oSelectorElem = $(oOptions.base_modal.selector).first();
if (oSelectorElem.length === 0) {
CombodoJSConsole.Error('Could not open modal dialog as the selector option did not return any element: ' + oOptions.base_modal.selector);
return null;