Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

clipper: remove valid attributes check Signed-off-by: 01zulfi <[email protected]>

01zulfi2d6142381bfd
diff --git a/packages/clipper/src/domtoimage.ts b/packages/clipper/src/domtoimage.ts
index 0ac13cefa..ed57a7a90 100644
--- a/packages/clipper/src/domtoimage.ts
+++ b/packages/clipper/src/domtoimage.ts
@@ -176,39 +176,9 @@ function makeSvgDataUri(node: HTMLElement, width: number, height: number) {
export { toJpeg, toBlob, toCanvas, toPixelData, toPng, toSvg, getInlinedNode };
-const VALID_ATTRIBUTES = [
- "src",
- "href",
- "title",
- "style",
- "srcset",
- "sizes",
- "width",
- "height",
- "target",
- "rel",
- "class",
- "id",
- "disabled",
- "type",
- "data-",
- "aria-"
-];
-
function finalize(root: HTMLElement) {
for (const element of root.querySelectorAll("*")) {
if (!(element instanceof HTMLElement) || isSVGElement(element)) continue;
- for (const attribute of Array.from(element.attributes)) {
- if (attribute.name === "class" && element.className.includes("pseudo--"))
- continue;
-
- const isValidAttribute = VALID_ATTRIBUTES.some((attr) =>
- attribute.name.startsWith(attr)
- );
- if (!isValidAttribute) {
- element.removeAttribute(attribute.name);
- }
- }
if (element instanceof HTMLAnchorElement) {
element.href = element.href.startsWith("http")