jaxon-php / jaxon-js

The Jaxon javascript library https://www.jaxon-php.org.
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

Problem with find function in jaxon.core.js:2238 in version 4.0.4 #27

Closed sdaeges closed 2 months ago

sdaeges commented 2 months ago

Hello once again,

I've just upgraded to jaxon-js version 4.0.4 and I might have found a problem:

TypeError: loadedScripts.find is not a function at self.includeScriptOnce [as func] (jaxon.core.js:2238:44) at self.call (jaxon.core.js:1227:24) at execute (jaxon.core.js:1171:21) at processCommand (jaxon.core.js:1183:13) at self.processCommands (jaxon.core.js:1208:18) at self.jsonProcessor [as responseProcessor] (jaxon.core.js:1814:21) at self.received (jaxon.core.js:1852:25) at oRequest.responseHandler (jaxon.core.js:1532:21)

It seems like loadedScripts is a HTMLCollection at this point, which does not have a find-function. Since Arrays do, I replaced the line 2236 with this:

const loadedScripts = Array.prototype.slice.call(baseDocument.getElementsByTagName('script'));

to convert the HTMLCollection into an Array, which seemed to do the trick.

Regards,

Sascha

feuzeu commented 2 months ago

Fixed in release https://github.com/jaxon-php/jaxon-js/releases/tag/v4.0.5.