Project

Profile

Help

Feature #3570

closed

Add a function or instruction like ixsl:remove-property

Added by Pieter Masereeuw about 6 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Category:
IXSL extensions
Sprint/Milestone:
-
Start date:
2017-12-12
Due date:
% Done:

100%

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

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)

Actions #1

Updated by Debbie Lockett about 6 years ago

Consider this for Saxon-JS 2.0, and Saxon 9.9.

Actions #2

Updated by Debbie Lockett about 6 years ago

  • Subject changed from Add a functionor instruction like ixsl:remove-property to Add a function or instruction like ixsl:remove-property
Actions #3

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

Actions #4

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

Actions #5

Updated by Debbie Lockett over 3 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).

Actions #6

Updated by Michael Kay over 3 years ago

  • Status changed from Resolved to Closed
  • Fixed in JS Release set to Saxon-JS 2.0
Actions #7

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