Bug #3501
closedError when object supplied to ixsl:get() is null
100%
Description
If ixsl:get() is called on an object which is null, this throws a JavaScript TypeError e.g. "TypeError: Cannot read property 'localName' of null". This error should be handled better by Saxon-JS to produce an XError with a more informative message.
Note that if ixsl:call() is called on an object which is null, then this produces a decent XError because it fails a cardinality check: "Required cardinality of first argument of ixsl:call() is exactly one; supplied value is empty at test.xsl#15".
Updated by Debbie Lockett about 7 years ago
Similarly, when a node supplied to ixsl:style() is not found, we currently get a JavaScript TypeError:
"Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'."
Updated by Debbie Lockett about 7 years ago
- Subject changed from Improve error message when object supplied to ixsl:get() is null to Error when object supplied to ixsl:get() is null
- Status changed from New to In Progress
We decided that actually, if an empty sequence (JavaScript null object) is supplied as the first argument to ixsl:get(), then we should return an empty sequence, rather than producing an error.
Note that this ensures that (as the documentation states): "ixsl:get($object, "prop") and $object?prop are interchangeable". i.e. these give the same results, including the case when $object is null.
Similarly, if the argument supplied to ixsl:style() is not an Element (i.e. if it is null, or some other object), then we should return an empty map.
Fixes committed on 1.0 and trunk branches.
A number of JS unit tests have been added: ixsl/getEmpty01 - 04, ixsl/styleEmpty01, ixslErr/callErr03.
The documentation needs to be updated to clarify these cases.
Updated by Debbie Lockett about 7 years ago
- Status changed from In Progress to Resolved
- Fix Committed on JS Branch 1.0, Trunk added
Documentation updated.
I have made these changes in the online documentation - to add further details/clarification for how the functions should work, even though bugs like this one remain for now.
Updated by Debbie Lockett over 6 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in JS Release set to Saxon-JS 1.1.0
Bug fix applied in the Saxon-JS 1.1.0 maintenance release.
Please register to edit this issue
Also available in: Atom PDF Tracking page