globalpayments / rxp-js

Global Payments Ecommerce JavaScript Library
MIT License
34 stars 70 forks source link

openWindow fails on IE as form is created from incorrect DOM #18

Open flynnawtc opened 6 years ago

flynnawtc commented 6 years ago

rxp-js version 1.2.1 Internet Explorer (version 11) throws an exception on line 241 when it tries to append the newly created form to the body of the document in the new tabWindow. The cause is that the form and its sub-elements were created from the DOM of the original page, and not that of the newly created tabWindow.document. This can be tested in IE by resizing the window to a height of less than 360px then loading the page containing the rxp-js javascript. Instead of a lightbox, a new tab is opened but the exception prevents the page from being loaded.

The fix is to change line 113 from function createForm(doc){ to function createForm(document){

Alternatively, all references to document in the createForm method should be changed to 'doc'.

Either fix will force the correct DOM to be used, and the page renders correctly. This fix has been tested on IE, Firefox and Chrome.

Regards

Adrian Flynn