Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
42 stars 7 forks source link

Links to page with hash busted in SPA #325

Closed bob2517 closed 1 year ago

bob2517 commented 1 year ago

This actually just wasn't implemented at the time and there wasn't a test set up for it.

A fix is now on the branch.

Eg. from a different page you can now put this and it will work as expected, if @pages is set up correctly:

<a href="/mygallery#house">House picture</a>

Per the current docs and to keep things backward compatible, there would be two @pages items for this to work, "/mygallery", and the "#house" event. See the https://activecss.org/manual/spa-image-modal.html page for the example, which hasn't changed.

Looking at it afresh, this method does limit an SPA to only having unique hash references, so at some point a single @pages reference with the whole URL will be implemented as an alternative syntax, so that #house is tied to the page itself. It's getting a bit niche though, so I'll be adding that one a bit later on unless it's requested.

As an additional note, the hash @pages declaration doesn't have to be in a global @pages declaration covering the whole SPA. It can just reside embedded in the page itself if needed. The core doesn't look at the @pages event, or the regular event that simulates opening up the hash until the page has fully loaded, so the event can be embedded in the page. But the underlying page would still need to be in the global @pages declaration - ie. "permanently" in memory for the whole SPA and not dynamically appearing and disappearing like an embedded style tag.

bob2517 commented 1 year ago

Closing pending release.