@@ -679,8 +679,7 @@ var createXFormObjectCallback = function(fieldArray, scope) {
679679 }
680680} ;
681681
682- var initializeAcroForm = function ( scope , formObject ) {
683- formObject . scope = scope ;
682+ var initializeAcroForm = function ( scope ) {
684683 if (
685684 scope . internal !== undefined &&
686685 ( scope . internal . acroformPlugin === undefined ||
@@ -2428,11 +2427,8 @@ AcroFormRadioButton.prototype.createOption = function(name) {
24282427 child . BS = Object . assign ( { } , child . Parent . _BS ) ;
24292428 child . MK = Object . assign ( { } , child . Parent . _MK ) ;
24302429
2431- // Add to Parent
24322430 this . Kids . push ( child ) ;
2433-
24342431 addField . call ( this . scope , child ) ;
2435-
24362432 return child ;
24372433} ;
24382434
@@ -2686,10 +2682,13 @@ inherit(AcroFormTextFieldChild, AcroFormTextField);
26862682AcroFormTextFieldParent . prototype . createChild = function ( ) {
26872683 var child = new AcroFormTextFieldChild ( ) ;
26882684 child . Parent = this ;
2689- this . Kids . push ( child ) ;
2690-
2691- child . page = this . scope . internal . getCurrentPageInfo ( ) . pageNumber ;
26922685
2686+ // fixme test these
2687+ // child.BS = Object.assign({}, child.Parent._BS);
2688+ // child.MK = Object.assign({}, child.Parent._MK);
2689+
2690+ this . Kids . push ( child ) ;
2691+ addField . call ( this . scope , child ) ;
26932692 return child ;
26942693} ;
26952694
@@ -3860,14 +3859,14 @@ AcroFormAppearance.internal.getHeight = function(formObject) {
38603859 * @returns {jsPDF }
38613860 */
38623861var addField = ( jsPDFAPI . addField = function ( fieldObject ) {
3863- initializeAcroForm ( this , fieldObject ) ;
3864-
3865- if ( fieldObject instanceof AcroFormField ) {
3866- putForm ( fieldObject ) ;
3867- } else {
3862+ initializeAcroForm ( this ) ;
3863+ if ( ! ( fieldObject instanceof AcroFormField ) ) {
38683864 throw new Error ( "Invalid argument passed to jsPDF.addField." ) ;
38693865 }
3870- fieldObject . page = fieldObject . scope . internal . getCurrentPageInfo ( ) . pageNumber ;
3866+
3867+ fieldObject . scope = this ;
3868+ fieldObject . page = this . internal . getCurrentPageInfo ( ) . pageNumber ;
3869+ putForm ( fieldObject ) ;
38713870 return this ;
38723871} ) ;
38733872
0 commit comments