@webjsdev/core 0.7.27 → 0.7.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webjs-core-browser.js +1 -1
- package/dist/webjs-core-browser.js.map +1 -1
- package/dist/webjs-core.js +1 -1
- package/dist/webjs-core.js.map +1 -1
- package/package.json +1 -1
- package/src/html.js +9 -3
- package/src/router-client.js +8 -0
- package/src/slot.js +1 -1
package/package.json
CHANGED
package/src/html.js
CHANGED
|
@@ -24,7 +24,13 @@ export function isTemplate(x) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Marker used in the DOM to find hydration points.
|
|
28
|
-
*
|
|
27
|
+
* Marker used in the DOM to find hydration points. It is interpolated into
|
|
28
|
+
* BOTH comment markers (`<!--${MARKER}0-->`) and part-sentinel ATTRIBUTE names
|
|
29
|
+
* (`data-${MARKER}0`), so it MUST contain only characters valid in an XML
|
|
30
|
+
* qualified name. A `$` (the original value `'w$'`) is NOT valid in an
|
|
31
|
+
* attribute name: most engines tolerate it, but iOS WebKit's `setAttribute`
|
|
32
|
+
* enforces the spec and throws `InvalidCharacterError: Invalid qualified name`,
|
|
33
|
+
* which crashed `createInstance` for every slot template on iOS (#730). Keep it
|
|
34
|
+
* to `[a-z][a-z0-9-]*`. Enforced by `test/rendering/marker-valid-attr-name.test.js`.
|
|
29
35
|
*/
|
|
30
|
-
export const MARKER = '
|
|
36
|
+
export const MARKER = 'wjm-';
|
package/src/router-client.js
CHANGED
|
@@ -765,6 +765,14 @@ const snapshotCache = new Map();
|
|
|
765
765
|
*/
|
|
766
766
|
function snapshotCurrent(url) {
|
|
767
767
|
const key = cacheKey(url);
|
|
768
|
+
// Let components and app code strip transient state (open overlays, toasts,
|
|
769
|
+
// in-progress wizard steps) from the page BEFORE it is serialized into the
|
|
770
|
+
// back/forward cache, so a later popstate restore shows a clean page rather
|
|
771
|
+
// than, say, a hover-card frozen open (#766, Turbo's `before-cache` contract).
|
|
772
|
+
// Fires SYNCHRONOUSLY on the live DOM right before the outerHTML read, so a
|
|
773
|
+
// handler's mutations are captured; the live edits are invisible because the
|
|
774
|
+
// page is being navigated away from.
|
|
775
|
+
document.dispatchEvent(new CustomEvent('webjs:before-cache', { detail: { url } }));
|
|
768
776
|
// Move-to-front for LRU.
|
|
769
777
|
if (snapshotCache.has(key)) snapshotCache.delete(key);
|
|
770
778
|
/** @type {Snapshot} */
|
package/src/slot.js
CHANGED
|
@@ -436,7 +436,7 @@ export function attachSlotObservers(host) {
|
|
|
436
436
|
// Skip records produced by the framework's own renderer. Each
|
|
437
437
|
// top-level TemplateInstance commit (`createInstance`) and each
|
|
438
438
|
// child-part template swap (`applyChildPart`) inserts and removes
|
|
439
|
-
// its content as a unit bounded by `
|
|
439
|
+
// its content as a unit bounded by `wjm-s`/`wjm-e` comment markers
|
|
440
440
|
// (see render-client.js). When such a record reaches the host's
|
|
441
441
|
// childList observer, treating its addedNodes as authored
|
|
442
442
|
// children pollutes assignedByName with the renderer's own
|