Skip to content

Commit

Permalink
* xover.site.scrollRestoration - changed how scrollRestoration state …
Browse files Browse the repository at this point in the history
…is revised

* xover.site.state - fixed autoregistration when a non-existing state is requested
* section_renderer_handler - added condition for sections to render with document's stylesheets only if it has no ancestor-or-self xo-stylesheet tag
  • Loading branch information
uriel-online committed Jan 31, 2024
1 parent e3137b2 commit 3e4430d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ Object.defineProperty(xover.site, 'location', {

Object.defineProperty(xover.site, 'scrollRestoration', {
get() {
return xover.state.scrollRestoration || (document.querySelector('meta[name=scroll-restoration]') || document.createElement('p')).getAttribute("content") || history.scrollRestoration
return 'scrollRestoration' in xover.state && xover.state.scrollRestoration || (document.querySelector('meta[name=scroll-restoration]') || document.createElement('p')).getAttribute("content") || history.scrollRestoration
}
, set(value) {
xover.state.scrollRestoration = value;
Expand Down Expand Up @@ -1904,6 +1904,9 @@ Object.defineProperty(xover.site, 'state', {
}
} else if (key in xover.manifest.state) {
return_value = xover.manifest.state[key];
} else {
self[key] = {};
return_value = self[key]
}
if (typeof (return_value) == 'string' && return_value.indexOf("${") != -1) {
let formula = return_value;
Expand Down Expand Up @@ -11536,7 +11539,7 @@ xover.modernize = async function (targetWindow) {
await source_document.ready
}
}
stylesheets = stylesheet && [stylesheet.value] || source_document && source_document.getStylesheets() || [];
stylesheets = stylesheet && [stylesheet.value] || source_document && !this.closest("[xo-stylesheet]") && source_document.getStylesheets() || [];
if (stylesheets.length) {
stylesheets = stylesheets.map(stylesheet => typeof (stylesheet) === 'string' && { type: 'text/xsl', href: stylesheet, target: self, store: (target_store || {}).tag } || stylesheet instanceof ProcessingInstruction && xover.json.fromAttributes(stylesheet.data) || null).filter(stylesheet => stylesheet);
for (let stylesheet of stylesheets) {
Expand Down

0 comments on commit 3e4430d

Please sign in to comment.