Skip to content

Commit

Permalink
move link elements to head
Browse files Browse the repository at this point in the history
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 2, 2023
1 parent ba64f83 commit 4736a13
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 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,14 @@ 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 4736a13

Please sign in to comment.