Skip to content

Commit e7835bc

Browse files
committed
Add setter to AcroFormField Subtype property
The Subtype property had only a getter which made it read-only. In JavaScript non-strict mode, setting a getter-only property silently fails. But TypeScript compiles to strict mode which throws an error. Added a setter that stores the value in a private variable _Subtype. The getter now checks if _Subtype was explicitly set and returns that, otherwise falls back to the computed value (/Widget or null based on hasAnnotation). This fixes the 6 failing acroform tests that were trying to set radioGroup.Subtype.
1 parent 92edd04 commit e7835bc

15 files changed

+53
-25
lines changed

dist/jspdf.es.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T04:12:59.142Z
5-
* CommitID 1f385431cc
4+
* Version 3.0.3 Built on 2025-11-10T10:56:39.306Z
5+
* CommitID 92edd044e1
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com
@@ -7048,11 +7048,18 @@ var AcroFormField = function AcroFormField() {
70487048
return this.hasAnnotation ? "/Annot" : null;
70497049
}
70507050
});
7051+
var _Subtype = null;
70517052
Object.defineProperty(this, "Subtype", {
70527053
enumerable: true,
70537054
configurable: false,
70547055
get: function get() {
7056+
if (_Subtype !== null) {
7057+
return _Subtype;
7058+
}
70557059
return this.hasAnnotation ? "/Widget" : null;
7060+
},
7061+
set: function set(value) {
7062+
_Subtype = value;
70567063
}
70577064
});
70587065
var _hasAppearanceStream = false;

dist/jspdf.es.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.es.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.es.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.node.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T04:12:59.178Z
5-
* CommitID 1f385431cc
4+
* Version 3.0.3 Built on 2025-11-10T10:56:39.340Z
5+
* CommitID 92edd044e1
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com
@@ -7550,11 +7550,18 @@ let AcroFormField = function () {
75507550
return this.hasAnnotation ? "/Annot" : null;
75517551
}
75527552
});
7553+
let _Subtype = null;
75537554
Object.defineProperty(this, "Subtype", {
75547555
enumerable: true,
75557556
configurable: false,
75567557
get: function () {
7558+
if (_Subtype !== null) {
7559+
return _Subtype;
7560+
}
75577561
return this.hasAnnotation ? "/Widget" : null;
7562+
},
7563+
set: function (value) {
7564+
_Subtype = value;
75587565
}
75597566
});
75607567
let _hasAppearanceStream = false;

dist/jspdf.node.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.node.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.node.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.umd.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T04:12:59.108Z
5-
* CommitID 1f385431cc
4+
* Version 3.0.3 Built on 2025-11-10T10:56:39.273Z
5+
* CommitID 92edd044e1
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com
@@ -7133,11 +7133,18 @@
71337133
return this.hasAnnotation ? "/Annot" : null;
71347134
}
71357135
});
7136+
var _Subtype = null;
71367137
Object.defineProperty(this, "Subtype", {
71377138
enumerable: true,
71387139
configurable: false,
71397140
get: function get() {
7141+
if (_Subtype !== null) {
7142+
return _Subtype;
7143+
}
71407144
return this.hasAnnotation ? "/Widget" : null;
7145+
},
7146+
set: function set(value) {
7147+
_Subtype = value;
71417148
}
71427149
});
71437150
var _hasAppearanceStream = false;

dist/jspdf.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)