mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Introduce more optional chaining in the src/core/
folder
After PR 12563 we're now free to use optional chaining in the worker-thread as well. (This patch also fixes one previously "missed" case in the `web/` folder.) For the MOZCENTRAL build-target this patch reduces the total bundle-size by `1.6` kilobytes.
This commit is contained in:
parent
c20c1b3362
commit
1b4a7c5965
27 changed files with 90 additions and 137 deletions
|
@ -302,7 +302,7 @@ class SimpleDOMNode {
|
|||
}
|
||||
|
||||
get firstChild() {
|
||||
return this.childNodes && this.childNodes[0];
|
||||
return this.childNodes?.[0];
|
||||
}
|
||||
|
||||
get nextSibling() {
|
||||
|
@ -333,7 +333,7 @@ class SimpleDOMNode {
|
|||
}
|
||||
|
||||
hasChildNodes() {
|
||||
return this.childNodes && this.childNodes.length > 0;
|
||||
return this.childNodes?.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,7 +383,7 @@ class SimpleDOMNode {
|
|||
}
|
||||
}
|
||||
|
||||
if (node.childNodes && node.childNodes.length !== 0) {
|
||||
if (node.childNodes?.length > 0) {
|
||||
stack.push([node, 0]);
|
||||
node = node.childNodes[0];
|
||||
} else if (stack.length === 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue