Bug #5066
closedElement.localName is not implemented in saxon-js 2.3
100%
Description
I am currently using saxon-js 2.0.3, and my project runs without issues. I am trying to upgrade to 2.3, but I have encountered what I believe is a bug. It can be demonstrated as follows.
import saxon from "saxon-js";
const text = "<index>\
<entry name='A' />\
<entry name='B' />\
<entry name='C' />\
</index>";
saxon.getResource({ text, type: "xml" })
.then(document => {
const elements = saxon.XPath.evaluate("entry", document.documentElement);
for (const element of elements) {
console.log(element.localName); // this prints "entry" on 2.0.3, but prints "undefined" on 2.3
}
});
Updated by Michael Gunter over 3 years ago
The example can be further reduced to the following.
import saxon from "saxon-js";
saxon.getResource({ text: "<data />", type: "xml" })
.then(document => {
console.log(document.documentElement.localName); // this prints "data" on 2.0.3, but prints "undefined" on 2.3
});
Updated by Michael Gunter over 3 years ago
The issue appears to have been introduced in version 2.1.
Updated by Norm Tovey-Walsh over 3 years ago
Thanks for the reproducible case. We'll take a look as soon as possible.
Updated by Michael Kay almost 3 years ago
Sorry that we've rather dropped the ball on SaxonJS bug reports.
What puzzles me about this one is that the synchronous equivalent
console.log(saxon.XPath.evaluate("parse-xml('<data/>')").documentElement.localName)
works just fine.
Equally, it works if I do it in stages:
node --experimental-repl-await
>var saxon = require('saxon-js')
>var promise = saxon.getResource({text:"<data/>",type:"xml"})
>var doc = await promise;
>console.log(doc.documentElement.localName)
So I think there's something wrong with the way you're handling the returned promise.
Updated by Norm Tovey-Walsh over 2 years ago
- Status changed from New to Resolved
- Fix Committed on JS Branch main, saxonjs2 added
The DOM level2 externs for "localName", "prefix", and "namespaceURI" were missing.
Updated by Norm Tovey-Walsh over 2 years ago
- Fix Committed on JS Branch 2, Trunk added
- Fix Committed on JS Branch deleted (
main, saxonjs2)
Updated by Debbie Lockett over 2 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in JS Release set to SaxonJS 2.4
Bug fix applied in the SaxonJS 2.4 maintenance release.
Please register to edit this issue
Also available in: Atom PDF Tracking page