Skip to content
Permalink
Browse files

[JENKINS-48773] - Limit which section headers are added to the breadc…

…rumb config outline (#3213)

* [JENKINS-48773] Don't include section elements in repeatables

* Only include visible section headers

* Fix tests by checking for presence of method first
  • Loading branch information...
daniel-beck authored and oleg-nenashev committed Jan 11, 2018
1 parent deeab3a commit 02d0531add35154d051de71398aefb58b9295a3f
Showing with 9 additions and 3 deletions.
  1. +9 −3 core/src/main/resources/lib/form/section_.js
@@ -38,21 +38,27 @@ var section = (function (){
root = $(root||document.body);

/**
* Recursively visit elements and find all section headers.
* Recursively visit elements and find all visible section headers that are not inside f:repeatable elements.
*
* @param {HTMLElement} dom
* Parent element
* @param {SectionNode} parent
* Function that returns the array to which discovered section headers and child elements are added.
*/
function visitor(dom,parent) {
function isVisible(elem) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects && elem.getClientRects().length );
}

for (var e=dom.firstChild; e!=null; e=e.nextSibling) {
if (e.nodeType==1) {
if (e.className=="section-header") {
if (e.className=="section-header" && isVisible(e)) {
var child = new SectionNode(e);
parent.children.push(child);
// The next line seems to be unnecessary, as there are no children inside the section header itself.
// So this code will always returns a flat list of section headers.
visitor(e,child);
} else {
} else if (!e.classList.contains("repeated-container")) {
visitor(e,parent);
}
}

0 comments on commit 02d0531

Please sign in to comment.
You can’t perform that action at this time.