Skip to content

Commit

Permalink
[JENKINS-72358] Replace Prototype.js $(var) with var
Browse files Browse the repository at this point in the history
https://issues.jenkins.io/browse/JENKINS-72358 reports a JavaScript error
when the plus sign is clicked to expand the test results analyzer tree.

https://www.jenkins.io/blog/2023/05/12/removing-prototype-from-jenkins/
recommends replacing `$(variable)` with `variable`.  That's what I did in
3 cases in this change.

I've confirmed that the JavaScript message that was displayed with the
released version of the plugin is not displayed with these changes.
  • Loading branch information
MarkEWaite committed Nov 22, 2023
1 parent 470ad72 commit e3a1596
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/webapp/js/testresult.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function expandAll() {
}

function getDescendants(parentRow, level) {
var parentLevel = parseInt($(parentRow).attr("hierarchyLevel"));
var parentLevel = parseInt(parentRow.attr("hierarchyLevel"));
var descendantLevel = parentLevel + level;
var done = false;

Expand Down Expand Up @@ -167,7 +167,7 @@ function getAllDescendants(parentRow) {
function getAllAncestors(parentRow) {
var result = [];

var parentLevel = parseInt($(parentRow).attr("hierarchyLevel"));
var parentLevel = parseInt(parentRow.attr("hierarchyLevel"));
var nextAncestorLevel = parentLevel - 1;

var done = parentLevel < 0; // might not have any ancestors
Expand Down Expand Up @@ -218,7 +218,7 @@ function getSiblings(row) {
done = false;
var followingSiblings = $j(row).nextAll().filter(isSibling);

return $(previousSiblings).add(followingSiblings);
return previousSiblings.add(followingSiblings);
}

function addEvents() {
Expand Down Expand Up @@ -271,7 +271,7 @@ function checkChildren(row, checked) {

function areAllSiblingsChecked(row) {
var siblings = getSiblings(row);
return $(siblings).find("input:checked").length == siblings.length;
return siblings.find("input:checked").length == siblings.length;
}

function checkParent(row, checked) {
Expand Down

0 comments on commit e3a1596

Please sign in to comment.