kewisch / sepa.js

Create and validate SEPA XML transactions
http://kewisch.github.io/sepa.js
Other
88 stars 61 forks source link

Cannot set property xmlEncoding of `#<Document>` which has only a getter #56

Closed nicolaslohrer closed 11 months ago

nicolaslohrer commented 12 months ago

Hi @kewisch, thanks for merging and releasing my fix for #52!

As it turns out, it only seems to address half of the problem for us. It worked for a while but after we've switched to a different build setup, we're back to the same error in Chrome:

sepa.js:89 Uncaught TypeError: Cannot set property xmlEncoding of #<Document> which has only a getter
    at SepaDocument.toXML (sepa.js:89:25)
    at SepaDocument.toString (sepa.js:102:24)
    at pen.js?key=pen.js-772711c0-9717-49a1-2466-dddc332647a2:18:17

Here's a reproduction case with the new version (1.1.0): https://codepen.io/nicolasschabram/pen/QWYgXrW.

Looking at it again, it kinda makes sense that my previous PR didn't completely solve the issue. The fact that it worked for a while for us maybe has something to do with the available polyfills in our application but I didn't fully get to the bottom of it.

Anyway, xmlEncoding and xmlVersion are clearly deprecated and it doesn't seem to me like setting them serves any actual purpose in this library. So I've prepared another MR to remove them completely (like I hinted at in this earlier comment): https://github.com/kewisch/sepa.js/pull/57.

kewisch commented 11 months ago

Thanks again for the PR. I'm wondering if we should be using XMLSerializer instead, but that might be for a new issue.