Feature #3570
closedAdd a function or instruction like ixsl:remove-property
100%
Description
It would be nice to have a Saxon-JS extension function to explicitly remove a property (other than giving it some special value, such as the empty string; an empty sequence is not allowed)
Updated by Debbie Lockett almost 7 years ago
Consider this for Saxon-JS 2.0, and Saxon 9.9.
Updated by Debbie Lockett almost 7 years ago
- Subject changed from Add a functionor instruction like ixsl:remove-property to Add a function or instruction like ixsl:remove-property
Updated by Debbie Lockett over 4 years ago
- Description updated (diff)
- Status changed from New to In Progress
Code committed on Saxon 10.0 dev branch to add the IXSL extension instruction <ixsl:remove-property>
. The instruction can be used to remove a named property from a JavaScript object. It has mandatory attribute name
(the name of the property to be removed, or dot-separated composite name), and optional attribute object
(the object that the property belongs to, or when omitted, the window object is used). i.e. these attributes align with those on <ixsl:set-property>
.
ixsl:set-property
can be used to set a property to null; but ixsl:remove-property
would allow to actually remove own properties from objects. Note that inherited properties can not be removed. This can be implemented using the JavaScript delete
operator (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete). There is some Saxon-JS 2 implementation detail to work out here about whether we should throw a run time error, or produce a warning, in the cases when either the property doesn't exist, or the property cannot be removed.
Updated by Debbie Lockett over 4 years ago
Implemented and committed in Saxon-JS 2.0 dev branch (in ExtraFn.js).
Various JS2 unit tests added: ixsl/removeProperty01, 02, 03, 10 , 11; ixsl/setProperty05, 06.
Still TODO: documentation.
Updated by Debbie Lockett over 4 years ago
- Status changed from In Progress to Resolved
- Fix Committed on JS Branch Trunk added
Documentation added for Saxon-JS 2 (trunk development branch).
Updated by Michael Kay over 4 years ago
- Status changed from Resolved to Closed
- Fixed in JS Release set to Saxon-JS 2.0
Updated by Debbie Lockett over 4 years ago
- Category set to IXSL extensions
- Assignee set to Debbie Lockett
- % Done changed from 0 to 100
Please register to edit this issue
Also available in: Atom PDF Tracking page