From 1813ab0774d3174c8cb5466e5dfd8d2add9a613d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 29 Jul 2026 18:23:14 +0200 Subject: [PATCH] Use more more optional chaining in the `src/` folder --- src/core/xfa/builder.js | 8 +++----- src/scripting_api/proxy.js | 11 ++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/core/xfa/builder.js b/src/core/xfa/builder.js index 63af9b417..d736fd553 100644 --- a/src/core/xfa/builder.js +++ b/src/core/xfa/builder.js @@ -190,11 +190,9 @@ class Builder { if (hasNamespace) { this._currentNamespace = this._namespaceStack.pop(); } - if (prefixes) { - prefixes.forEach(({ prefix }) => { - this._namespacePrefixes.get(prefix).pop(); - }); - } + prefixes?.forEach(({ prefix }) => { + this._namespacePrefixes.get(prefix).pop(); + }); if (nsAgnostic) { this._nsAgnosticLevel--; } diff --git a/src/scripting_api/proxy.js b/src/scripting_api/proxy.js index d8bb6f0cb..fb235c582 100644 --- a/src/scripting_api/proxy.js +++ b/src/scripting_api/proxy.js @@ -43,13 +43,10 @@ class ProxyHandler { } set(obj, prop, value) { - if (obj._kidIds) { - // If the field is a container for other fields then - // dispatch the kids. - obj._kidIds.forEach(id => { - obj._appObjects[id].wrapped[prop] = value; - }); - } + // If the field is a container for other fields then dispatch the kids. + obj._kidIds?.forEach(id => { + obj._appObjects[id].wrapped[prop] = value; + }); if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) { const old = obj[prop];