Project

Profile

Help

Feature #2886

closed

Converting JS Objects to XDM maps

Added by Debbie Lockett over 7 years ago. Updated over 6 years ago.

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

100%

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

Description

[Mike email 24/07/2016]

JS-to-XDM conversion shouldn't construct a HashTrie as the conversion of a JS object; rather it should wrap the JS object as a JSValue, and a JSValue should behave like a map. To make a JSValue behave like a map, it needs to implement the same methods as HashTrie, at least for read access:

containsKey - true if the object contains the given key

get - if the object contains the given key, return the result of doing JS-to-XDM conversion on the corresponding value

inSituPut - throw error

put - throw error

remove - throw error

keys - return all the keys as XDMString objects

forAllPairs - a composite of keys() and get()

conforms - roughly the same logic as HashTrie.conforms()

and

SaxonJS.U.isMap(item) should return true if item is a JSValue.

With this, we don't have the conflict between JS objects (like Style) that are converted to maps, and others (like Window) that are wrapped as a JSValue.

Please register to edit this issue

Also available in: Atom PDF Tracking page