mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-30 19:07:22 +02:00
Shorten the AnnotationElement.prototype._getElementsByName method a tiny bit
This commit is contained in:
parent
8d1afad39b
commit
3736000aee
@ -803,27 +803,24 @@ class AnnotationElement {
|
||||
const fields = [];
|
||||
|
||||
if (this._fieldObjects) {
|
||||
const fieldObj = this._fieldObjects[name];
|
||||
if (fieldObj) {
|
||||
for (const { page, id, exportValues } of fieldObj) {
|
||||
if (page === -1) {
|
||||
continue;
|
||||
}
|
||||
if (id === skipId) {
|
||||
continue;
|
||||
}
|
||||
const exportValue =
|
||||
typeof exportValues === "string" ? exportValues : null;
|
||||
const fieldObj = this._fieldObjects[name] || [];
|
||||
|
||||
const domElement = document.querySelector(
|
||||
`[data-element-id="${id}"]`
|
||||
);
|
||||
if (domElement && !GetElementsByNameSet.has(domElement)) {
|
||||
warn(`_getElementsByName - element not allowed: ${id}`);
|
||||
continue;
|
||||
}
|
||||
fields.push({ id, exportValue, domElement });
|
||||
for (const { page, id, exportValues } of fieldObj) {
|
||||
if (page === -1) {
|
||||
continue;
|
||||
}
|
||||
if (id === skipId) {
|
||||
continue;
|
||||
}
|
||||
const exportValue =
|
||||
typeof exportValues === "string" ? exportValues : null;
|
||||
|
||||
const domElement = document.querySelector(`[data-element-id="${id}"]`);
|
||||
if (domElement && !GetElementsByNameSet.has(domElement)) {
|
||||
warn(`_getElementsByName - element not allowed: ${id}`);
|
||||
continue;
|
||||
}
|
||||
fields.push({ id, exportValue, domElement });
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user