crtc collapse: skip card-wrapped headings whose body isn't a sibling (fixes empty US-wholesale + banking expanders; vendor directory left inline)
This commit is contained in:
parent
345c22e561
commit
b1629160d5
1 changed files with 11 additions and 1 deletions
|
|
@ -27,7 +27,6 @@
|
|||
{ key: "corporate tax comparison", label: "Corporate tax comparison (BC vs US)" },
|
||||
{ key: "canada telecom m&a", label: "Canada telecom M&A climate" },
|
||||
{ key: "step 6: canadian business banking", label: "Canadian business banking" },
|
||||
{ key: "included: canadian wholesale", label: "Wholesale vendor directory" },
|
||||
{ key: "frequently asked questions", label: "FAQ", open: false },
|
||||
{ key: "us wholesale voice market", label: "US wholesale / DID restrictions" },
|
||||
{ key: "the growing burden", label: "The growing burden of a US carrier" },
|
||||
|
|
@ -79,6 +78,17 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Guard against card-wrapped headings whose body is NOT a following
|
||||
// sibling (e.g. an H2 alone in a flex header row inside a styled card).
|
||||
// In that case we'd collect only the heading and produce an accordion
|
||||
// that expands to nothing. Measure the real body text (excluding the H2)
|
||||
// and bail out, leaving the section inline, if there's nothing to show.
|
||||
var bodyText = nodes.reduce(function (acc, node) {
|
||||
if (node === h2) return acc;
|
||||
return acc + (node.textContent || "");
|
||||
}, "").replace(/\s+/g, " ").trim();
|
||||
if (bodyText.length < 200) return;
|
||||
|
||||
var details = document.createElement("details");
|
||||
details.className = "pw-collapse";
|
||||
if (cfg.open) details.open = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue