Project

Profile

Help

Bug #3501

Error when object supplied to ixsl:get() is null

Added by Debbie Lockett about 1 year ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Sprint/Milestone:
-
Start date:
2017-10-27
Due date:
% Done:

100%

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

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".

History

#1 Updated by Debbie Lockett about 1 year 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'."

#2 Updated by Debbie Lockett about 1 year 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.

#3 Updated by Debbie Lockett about 1 year 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.

#4 Updated by Debbie Lockett 7 months 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