File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ export class FormData {
6
6
* @param {HTMLFormElement } [form]
7
7
*/
8
8
constructor ( form ) {
9
+ /**
10
+ * @private
11
+ * @readonly
12
+ * @type {Array<[string, FormDataEntryValue]> }
13
+ */
14
+ this . _entries = [ ] ;
15
+
16
+ Object . defineProperty ( this , "_entries" , { enumerable : false } ) ;
17
+
9
18
if ( form !== undefined ) {
10
19
for ( const element of form . elements ) {
11
20
if ( isSelectElement ( element ) ) {
@@ -23,15 +32,6 @@ export class FormData {
23
32
}
24
33
}
25
34
}
26
-
27
- /**
28
- * @private
29
- * @readonly
30
- * @type {Array<[string, FormDataEntryValue]> }
31
- */
32
- this . _entries = [ ] ;
33
-
34
- Object . defineProperty ( this , "_entries" , { enumerable : false } ) ;
35
35
}
36
36
get [ Symbol . toStringTag ] ( ) {
37
37
return "FormData" ;
@@ -60,6 +60,9 @@ export class FormData {
60
60
) ,
61
61
filename
62
62
) {
63
+ if ( ! this . _entries ) {
64
+ throw new Error ( "FormData.append: missing entries..." ) ;
65
+ }
63
66
this . _entries . push ( [ name , toEntryValue ( value , filename ) ] ) ;
64
67
}
65
68
You can’t perform that action at this time.
0 commit comments