Don't generate '[+]'/'[-]' on 'empty' traits

This commit is contained in:
Guillaume Gomez
2018-03-05 20:17:34 +01:00
parent e2746d8700
commit a628543891

View File

@@ -1776,6 +1776,18 @@
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
function checkIfThereAreMethods(elems) {
var areThereMethods = false;
onEach(elems, function(e) {
if (hasClass(e, "method")) {
areThereMethods = true;
return true;
}
});
return areThereMethods;
}
var toggle = document.createElement('a');
toggle.href = 'javascript:void(0)';
toggle.className = 'collapse-toggle';
@@ -1786,12 +1798,11 @@
if (!next) {
return;
}
if (hasClass(next, 'docblock') ||
if (checkIfThereAreMethods(next.childNodes) &&
(hasClass(next, 'docblock') ||
hasClass(e, 'impl') ||
(hasClass(next, 'stability') &&
hasClass(next.nextElementSibling, 'docblock'))) {
insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]);
}
if (hasClass(e, 'impl')) {
hasClass(next.nextElementSibling, 'docblock')))) {
insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]);
}
}