___ ___ _____ _ ( _`\ ( _`\ ( _ ) _ ( ) | (_(_)| |_) )| (_) |(_) ___ | |__ `\__ \ | ,__/'| _ || |/',__)| _ `\ ( )_) || | | | | || |\__, \| | | | `\____)(_) (_) (_)(_)(____/(_) (_) A PicoSSG tool

spaish.details

API for preserving the open/closed state of <details> elements across page loads.

reopen(pageKey, nodeSelectors)

Stores which details elements are open before page unload and reopens them on page load.

Parameters

Description

The function sets up two main behaviors:

Storage (on beforeunload)

Restoration (immediate)

DOM Requirements

Storage Details

Example

// Track specific details elements
spaish.details.reopen('faq-page', [
  '#frequently-asked-questions',
  '#troubleshooting-section',
  '.expandable-info'
]);

// Cross-page navigation menu state
spaish.details.reopen('site-navigation', [
  '#main-menu',
  '#sidebar-sections'
]);

// Multiple selectors for flexible targeting
spaish.details.reopen('docs', [
  '[data-section="api"]',
  '[data-section="examples"]',
  'details.collapsible'
]);

Selector Behavior

Cross-Page Functionality

Error Handling

Browser Events

Performance Notes