@voila.dev/replay 0.3.0 → 0.3.1

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/play.js CHANGED
@@ -65,7 +65,8 @@ function mirror(doc, hooks = {}) {
65
65
  if (/^on/i.test(name) || name.toLowerCase() === "http-equiv") return;
66
66
  const tag = local(el);
67
67
  if (tag === "iframe" && (name === "src" || name === "srcdoc")) return;
68
- if (ADDRESS.test(name)) {
68
+ if (ADDRESS.test(name) && value.trim().startsWith("#")) value = value.trim();
69
+ else if (ADDRESS.test(name)) {
69
70
  value = absolute(value);
70
71
  if (!SAFE_URL.test(value)) value = "about:blank";
71
72
  else if (tag !== "link") value = kept(value);
package/dist/testing.js CHANGED
@@ -123,6 +123,21 @@ var CASES = [
123
123
  d.getElementById("b").textContent = "apr\xE8s";
124
124
  }
125
125
  },
126
+ {
127
+ name: 'symbole SVG repris par <use href="#\u2026">, et lien vers une ancre',
128
+ group: "parseur",
129
+ html: D(
130
+ '<svg width="0" height="0"><symbol id="star" viewBox="0 0 10 10"><path d="M5 0L10 10H0z"/></symbol></svg><a href="#b">aller</a><div id="a"></div><div id="b">avant</div>'
131
+ ),
132
+ run: (d) => {
133
+ const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
134
+ const use = d.createElementNS("http://www.w3.org/2000/svg", "use");
135
+ use.setAttribute("href", "#star");
136
+ svg.append(use);
137
+ d.getElementById("a")?.append(svg);
138
+ d.getElementById("b").textContent = "apr\xE8s";
139
+ }
140
+ },
126
141
  {
127
142
  name: "les cinq pi\xE8ges, pr\xE9sents d\xE8s le d\xE9part",
128
143
  group: "parseur",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voila.dev/replay",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Session recording and replay for the web: a small recorder, a flat tape format, a DOM-built player.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -129,7 +129,10 @@ export function mirror(doc: Document, hooks: MirrorHooks = {}): Mirror {
129
129
  if (/^on/i.test(name) || name.toLowerCase() === "http-equiv") return;
130
130
  const tag = local(el);
131
131
  if (tag === "iframe" && (name === "src" || name === "srcdoc")) return;
132
- if (ADDRESS.test(name)) {
132
+ // A reference inside the page (`<use href="#icon">`, `<a href="#main">`) stays one: made
133
+ // absolute, it would point at the recorded site, which the copy may not load.
134
+ if (ADDRESS.test(name) && value.trim().startsWith("#")) value = value.trim();
135
+ else if (ADDRESS.test(name)) {
133
136
  value = absolute(value);
134
137
  if (!SAFE_URL.test(value)) value = "about:blank";
135
138
  // A stylesheet's own address stays: its rules came on the tape, read from there.
@@ -150,6 +150,21 @@ export const CASES: ReadonlyArray<Case> = [
150
150
  (d.getElementById("b") as Element).textContent = "après";
151
151
  },
152
152
  },
153
+ {
154
+ name: "symbole SVG repris par <use href=\"#…\">, et lien vers une ancre",
155
+ group: "parseur",
156
+ html: D(
157
+ '<svg width="0" height="0"><symbol id="star" viewBox="0 0 10 10"><path d="M5 0L10 10H0z"/></symbol></svg><a href="#b">aller</a><div id="a"></div><div id="b">avant</div>',
158
+ ),
159
+ run: (d) => {
160
+ const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
161
+ const use = d.createElementNS("http://www.w3.org/2000/svg", "use");
162
+ use.setAttribute("href", "#star");
163
+ svg.append(use);
164
+ d.getElementById("a")?.append(svg);
165
+ (d.getElementById("b") as Element).textContent = "après";
166
+ },
167
+ },
153
168
  {
154
169
  name: "les cinq pièges, présents dès le départ",
155
170
  group: "parseur",