@instructure/platform-sanitize 0.3.1 → 0.3.2
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/index.js +10 -10
- package/dist/sanitizeUrl.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -171,23 +171,23 @@ const d = /* @__PURE__ */ new Set([
|
|
|
171
171
|
// throw in modern browsers.
|
|
172
172
|
RETURN_TRUSTED_TYPE: !0
|
|
173
173
|
};
|
|
174
|
-
let
|
|
174
|
+
let o = null;
|
|
175
175
|
function g() {
|
|
176
|
-
return
|
|
176
|
+
return o || (o = typeof a == "function" ? a(window) : a, o.addHook("afterSanitizeAttributes", (t) => {
|
|
177
177
|
if (!(t instanceof Element) || !t.hasAttribute("style")) return;
|
|
178
|
-
const e = t.style,
|
|
178
|
+
const e = t.style, i = [];
|
|
179
179
|
for (let r = 0; r < e.length; r++) {
|
|
180
180
|
const n = e.item(r);
|
|
181
|
-
d.has(n) ||
|
|
181
|
+
d.has(n) || i.push(n);
|
|
182
182
|
}
|
|
183
|
-
for (const r of
|
|
183
|
+
for (const r of i) e.removeProperty(r);
|
|
184
184
|
e.length === 0 && t.removeAttribute("style");
|
|
185
|
-
}),
|
|
185
|
+
}), o.addHook("uponSanitizeAttribute", (t, e) => {
|
|
186
186
|
c.has(e.attrName) && l.test(e.attrValue) && (e.keepAttr = !1);
|
|
187
|
-
}),
|
|
187
|
+
}), o.addHook("afterSanitizeAttributes", (t) => {
|
|
188
188
|
if (!(t instanceof Element) || !t.hasAttribute("srcset")) return;
|
|
189
189
|
(t.getAttribute("srcset") ?? "").split(",").map((r) => r.trim().split(/\s+/)[0]).some((r) => l.test(r)) && t.removeAttribute("srcset");
|
|
190
|
-
}),
|
|
190
|
+
}), o);
|
|
191
191
|
}
|
|
192
192
|
function p(t) {
|
|
193
193
|
if (typeof window > "u")
|
|
@@ -200,8 +200,8 @@ function h(t) {
|
|
|
200
200
|
const e = t.replace(/\\/g, "/");
|
|
201
201
|
if (u.test(e)) return "about:blank";
|
|
202
202
|
try {
|
|
203
|
-
const
|
|
204
|
-
return m.has(
|
|
203
|
+
const i = new URL(e, s);
|
|
204
|
+
return m.has(i.protocol) ? i.href.startsWith(s) ? t : e.replace(/[\x00-\x1F]/g, "") : "about:blank";
|
|
205
205
|
} catch {
|
|
206
206
|
return "about:blank";
|
|
207
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAoBlE"}
|