diff --git a/specs/data64/__image_snapshots_linux__/default-spec-js-default-should-create-a-pdf-1-snap.png b/specs/data64/__image_snapshots_linux__/default-spec-js-default-should-create-a-pdf-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..9f2861e50613d383ebd19c96be389434988478b3 Binary files /dev/null and b/specs/data64/__image_snapshots_linux__/default-spec-js-default-should-create-a-pdf-1-snap.png differ diff --git a/specs/data64/__image_snapshots_mac__/default-spec-js-default-should-create-a-pdf-1-snap.png b/specs/data64/__image_snapshots_mac__/default-spec-js-default-should-create-a-pdf-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..1ffcc9b791dd79968ce2f8acf729e0bf717b85e8 Binary files /dev/null and b/specs/data64/__image_snapshots_mac__/default-spec-js-default-should-create-a-pdf-1-snap.png differ diff --git a/specs/data64/data64.html b/specs/data64/data64.html new file mode 100644 index 0000000000000000000000000000000000000000..d19af7e64bc588cd9de5f5c68889816d0b2e5043 --- /dev/null +++ b/specs/data64/data64.html @@ -0,0 +1,85 @@ + + + + + + Data-64 for paged.js + + + + + +
+
+
Title
+
+ console.log('hello') +
+
+
+
+
+
Title
+
+ console.log('hello') +
+
+
+ + + \ No newline at end of file diff --git a/specs/data64/data64.spec.js b/specs/data64/data64.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..30beebaffb9f76c8a52cb32d92cbf5377a445162 --- /dev/null +++ b/specs/data64/data64.spec.js @@ -0,0 +1,32 @@ +const TIMEOUT = 10000; // Some book might take longer than this to renderer + +describe("default", async () => { + let page; + let rendered; + beforeAll(async () => { + page = await loadPage("data64/data64.html"); + return page.rendered; + }, TIMEOUT); + + afterAll(async () => { + if (!DEBUG) { + await page.close(); + } + }); + + it("pseudo element with data:/image should appear", async () => { + + let data = await page.$eval("#test" , (r) => window.getComputedStyle(r, "::before").content); + + expect(data).toEqual("url(\"data:image/svg+xml,\")"); + }); + + // if (!DEBUG) { + // it('should create a pdf', async () => { + // let pdf = await page.pdf(PDF_SETTINGS); + + // expect(pdf).toMatchPDFSnapshot(1); + // }) + // } +} +); diff --git a/src/polisher/sheet.js b/src/polisher/sheet.js index 80b4d2b6cf61c611db32c211f06a9edee0fa3094..0fa6e4f364c4b5e0979534724f68e329a6b8bce3 100644 --- a/src/polisher/sheet.js +++ b/src/polisher/sheet.js @@ -174,9 +174,11 @@ class Sheet { csstree.walk(ast, { visit: "Url", enter: (node, item, list) => { - let href = node.value.value.replace(/["']/g, ""); - let url = new URL(href, this.url); - node.value.value = url.toString(); + if (!node.value.value.includes("data:")) { + let href = node.value.value.replace(/["']/g, ""); + let url = new URL(href, this.url); + node.value.value = url.toString(); + } } }); }