Skip to content

Commit

Permalink
[JENKINS-72196] avoid wrong styling when deleting the first of 2 shel…
Browse files Browse the repository at this point in the history
…l steps (#8739)

move link elements to head

fixes JENKINS-72196 when in a form there are repeatables that both
contain a codemirror config via a textarea. When deleting the first
of those it can happen that the link elements importing the css for
codemirror are defined in a div that gets deleted. This effectively
removes the css from the DOM tree, so that other textareas afterwards
that also require the codemirror css are no longer styled properly.

The Behaviour uses a high negative value for the priority so that the
move of the link elements is applied before any other behaviour jumps
in, e.g. hetero-list and repeatable add the elements to the dom via
jelly of all things can that can be added and later remove them from the
dom and keep them in memory.
  • Loading branch information
mawinter69 committed Dec 4, 2023
1 parent ee6535f commit dc983d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,13 @@ function rowvgStartEachRow(recursive, f) {
}

(function () {
// This moves all link elements to the head
// fixes JENKINS-72196 when a link is inside a div of a repeatable and the
// div is deleted then the styling is lost for divs afterwards.
Behaviour.specify("body link", "move-css-to-head", -9999, function (link) {
document.head.appendChild(link);
});

var p = 20;
Behaviour.specify("TABLE.sortable", "table-sortable", ++p, function (e) {
// sortable table
Expand Down

0 comments on commit dc983d0

Please sign in to comment.