Project

Profile

Help

Bug #5066

closed

Element.localName is not implemented in saxon-js 2.3

Added by Michael Gunter over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-08-21
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
2, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

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
    }

});
Actions #1

Updated by Michael Gunter over 2 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

});
Actions #2

Updated by Michael Gunter over 2 years ago

The issue appears to have been introduced in version 2.1.

Actions #3

Updated by Norm Tovey-Walsh over 2 years ago

Thanks for the reproducible case. We'll take a look as soon as possible.

Actions #4

Updated by Michael Kay about 2 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.

Actions #6

Updated by Norm Tovey-Walsh almost 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.

Actions #7

Updated by Norm Tovey-Walsh almost 2 years ago

  • Fix Committed on JS Branch 2, Trunk added
  • Fix Committed on JS Branch deleted (main, saxonjs2)
Actions #8

Updated by Debbie Lockett almost 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