Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade jQuery to 3.5.x #4929

Merged
merged 5 commits into from Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion war/package.json
Expand Up @@ -51,7 +51,7 @@
"babel-loader": "^8.0.6",
"bootstrap": "3.3.5",
"jenkins-js-modules": "^1.5.0",
"jquery": "2.1.4",
"jquery": "3.5.1",
"stylelint": "^13.0.0",
"window-handle": "^1.0.0"
},
Expand Down
8 changes: 7 additions & 1 deletion war/src/main/js/config-scrollspy.js
Expand Up @@ -44,6 +44,12 @@ $(function() {
page.onWinScroll(function () {
stickTabbar(tabBar);
});

// Manually trigger a repaint, otherwise Folder forms will not position
// the buttons correctly. This is caused by upgrading jQuery to 3.5.x,
// and probably has something to do with event listeners running in
// different order.
layoutUpdateCallback.call()
}, {trackSectionVisibility: true});
});

Expand Down Expand Up @@ -91,7 +97,7 @@ function autoActivateTabs(tabBar) {
if (!section.isVisible()) {
return;
}

// each section enters the viewport at its distance down the page, less the height of
// the toolbar, which hangs down the page. Or it is zero if the section doesn't
// match or was removed...
Expand Down
4 changes: 2 additions & 2 deletions war/src/main/js/pluginSetupWizardGui.js
Expand Up @@ -412,9 +412,9 @@ var createPluginSetupWizard = function(appendTarget) {
installPlugins(pluginManager.recommendedPluginNames());
});
};

var enableButtonsAfterFrameLoad = function() {
$('iframe[src]').load(function() {
$('iframe[src]').on('load', function() {
$('button').prop({disabled:false});
});
};
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/js/util/page.js
Expand Up @@ -19,7 +19,7 @@ function onload(selector, callback, contextEl) {
}
function scan() {
var elements = $(selector, contextEl).not(loadedClass);
if (elements.size() > 0) {
if (elements.length > 0) {
elements.addClass(loadedClass);
if (callback(elements) === true) {
registerRescan();
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/js/widgets/config/model/ConfigRowGrouping.js
Expand Up @@ -65,7 +65,7 @@ ConfigRowGrouping.prototype.updateVisibility = function() {
ConfigRowGrouping.prototype.findToggleWidget = function(row) {
var $ = getJQuery();
var input = $(':input.block-control', row);
if (input.size() === 1) {
if (input.length === 1) {
this.toggleWidget = input;
this.label = input.parent().find('label').text();
input.addClass('disable-behavior');
Expand Down
4 changes: 2 additions & 2 deletions war/src/main/js/widgets/config/model/ConfigSection.js
Expand Up @@ -90,7 +90,7 @@ ConfigSection.prototype.getRows = function() {
var numNewRows = 0;

rows.push(curTr);
while(curTr.size() === 1 && !curTr.hasClass('section-header-row')) {
while(curTr.length === 1 && !curTr.hasClass('section-header-row')) {
rows.push(curTr);
if (!curTr.hasClass(this.id)) {
numNewRows++;
Expand Down Expand Up @@ -155,7 +155,7 @@ ConfigSection.prototype.hasText = function(text) {
var row = sectionRows[i1];
var elementsWithText = $(selector, row);

if (elementsWithText.size() > 0) {
if (elementsWithText.length > 0) {
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions war/src/main/js/widgets/config/tabbar.js
Expand Up @@ -30,7 +30,7 @@ export var addPageTabs = function(configSelector, onEachConfigTable, options) {
page.onload('.block-control', function() {
// Only do job configs for now.
var configTables = $(configSelector);
if (configTables.size() > 0) {
if (configTables.length > 0) {
var tabBarShowPreference = jenkinsLocalStorage.getGlobalItem(tabBarShowPreferenceKey, "yes");

page.fixDragEvent(configTables);
Expand Down Expand Up @@ -78,7 +78,7 @@ export var addTabs = function(configTable, options) {
} else if (typeof configTable === 'string') {
// It's a config <table> selector
var configTableEl = $(configTable);
if (configTableEl.size() === 0) {
if (configTableEl.length === 0) {
throw "No config table found using selector '" + configTable + "'";
} else {
configTableMetadata = tableMetadata.fromConfigTable(configTableEl);
Expand Down
20 changes: 10 additions & 10 deletions war/src/test/js/pluginSetupWizard.spec.js
Expand Up @@ -242,7 +242,7 @@ describe("pluginSetupWizard.js", function () {
test(function() {
// Make sure the dialog was shown
var $wizard = $body.find('.plugin-setup-wizard');
expect($wizard.size()).toBe(1);
expect($wizard.length).toBe(1);

done();
}, { $, $body });
Expand Down Expand Up @@ -296,10 +296,10 @@ describe("pluginSetupWizard.js", function () {
test(function() {
// Make sure the dialog was shown
var wizard = $body.find('.plugin-setup-wizard');
expect(wizard.size()).toBe(1);
expect(wizard.length).toBe(1);

var goButton = $body.find('.install-recommended');
expect(goButton.size()).toBe(1);
expect(goButton.length).toBe(1);

// validate a call to installPlugins with our defaults
validatePlugins(['subversion'], function() {
Expand Down Expand Up @@ -367,8 +367,8 @@ describe("pluginSetupWizard.js", function () {
};

test(function() {
expect($body.find('.install-done').size()).toBe(0);
expect($body.find('.install-done-restart').size()).toBe(1);
expect($body.find('.install-done').length).toBe(0);
expect($body.find('.install-done-restart').length).toBe(1);
done();
}, { ajaxMappings, $, $body });
});
Expand All @@ -391,8 +391,8 @@ describe("pluginSetupWizard.js", function () {
},
};
test(function() {
expect($body.find('.install-done').size()).toBe(0);
expect($body.find('.install-done-restart').size()).toBe(0);
expect($body.find('.install-done').length).toBe(0);
expect($body.find('.install-done-restart').length).toBe(0);
done();
}, { ajaxMappings, $, $body });
});
Expand All @@ -415,8 +415,8 @@ describe("pluginSetupWizard.js", function () {
},
};
test(function() {
expect($body.find('.install-done').size()).toBe(1);
expect($body.find('.install-done-restart').size()).toBe(0);
expect($body.find('.install-done').length).toBe(1);
expect($body.find('.install-done-restart').length).toBe(0);
done();
}, { ajaxMappings, $, $body });
});
Expand Down Expand Up @@ -492,7 +492,7 @@ describe("pluginSetupWizard.js", function () {
};
test(function() {
var goButton = $body.find('.install-recommended');
expect(goButton.size()).toBe(1);
expect(goButton.length).toBe(1);

// validate a call to installPlugins with our defaults
setTimeout(function() {
Expand Down
175 changes: 0 additions & 175 deletions war/src/test/js/widgets/config/scrollspy.spec.js

This file was deleted.