Don't add an undefined id to the span for marked content
It fixes #20102.
This commit is contained in:
parent
9f645fb9a6
commit
86d58b637f
@ -290,7 +290,7 @@ class TextLayer {
|
||||
const parent = this.#container;
|
||||
this.#container = document.createElement("span");
|
||||
this.#container.classList.add("markedContent");
|
||||
if (item.id !== null) {
|
||||
if (item.id) {
|
||||
this.#container.setAttribute("id", `${item.id}`);
|
||||
}
|
||||
parent.append(this.#container);
|
||||
|
||||
@ -281,4 +281,25 @@ describe("accessibility", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("No undefined id", () => {
|
||||
let pages;
|
||||
|
||||
beforeEach(async () => {
|
||||
pages = await loadAndWait("issue20102.pdf", ".textLayer");
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that span hasn't an 'undefined' id", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const id = await page.$eval("span.markedContent", span => span.id);
|
||||
expect(id).withContext(`In ${browserName}`).toBe("");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -732,3 +732,4 @@
|
||||
!bug1974436.pdf
|
||||
!firefox_logo.pdf
|
||||
!issue20062.pdf
|
||||
!issue20102.pdf
|
||||
|
||||
151
test/pdfs/issue20102.pdf
Executable file
151
test/pdfs/issue20102.pdf
Executable file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user