diff options
Diffstat (limited to 'src/content/dependencies/generateStickyHeadingContainer.js')
-rw-r--r-- | src/content/dependencies/generateStickyHeadingContainer.js | 60 |
1 files changed, 3 insertions, 57 deletions
diff --git a/src/content/dependencies/generateStickyHeadingContainer.js b/src/content/dependencies/generateStickyHeadingContainer.js index ab607a4f..7cfbcf50 100644 --- a/src/content/dependencies/generateStickyHeadingContainer.js +++ b/src/content/dependencies/generateStickyHeadingContainer.js @@ -28,63 +28,9 @@ export default { html.tag('div', {class: 'content-sticky-heading-cover'}, {[html.onlyIfContent]: true}, - (() => { - if (html.isBlank(slots.cover)) { - return html.blank(); - } - - // Try very hard to set the cover's 'mode' slot to 'thumbnail' - // and its 'details' slot to html.blank(). - let setMode = false; - let setDetails = false; - let cover = slots.cover; - while (true) { - if (!cover) { - return html.blank(); - } - - if (!(cover instanceof html.Template)) { - return cover; - } - - // The cover from `slots` is already cloned (since it's - // mutable), but later ones are not, and for extremely scary - // content function infrastructure reasons, it is possible - // for the identity of the content of the clone-template - // to be the same as the cloned template. - if (cover !== slots.cover) { - cover = cover.clone(); - } - - if (!setMode) { - try { - cover.setSlot('mode', 'thumbnail'); - setMode = true; - } catch { - // No mode slot, or it doesn't allow 'thumbnail'. - } - } - - if (!setDetails) { - try { - cover.setSlot('details', html.blank()); - setDetails = true; - } catch { - // No details slot, or it doesn't allow html.blank(). - // We're setting a blank instead of null because null is - // always allowed, and can carry a different semantic - // meaning, like "put something else here by default - // instead please". - } - } - - if (setMode && setDetails) { - return cover; - } - - cover = cover.content; - } - })())), + (html.isBlank(slots.cover) + ? html.blank() + : slots.cover.slot('mode', 'thumbnail')))), ]), html.tag('div', {class: 'content-sticky-subheading-row'}, |