ion-js icon indicating copy to clipboard operation
ion-js copied to clipboard

Override property enumeration behavior for dom.Struct

Open zslayton opened this issue 5 years ago • 0 comments

dom.Struct uses a Proxy object to intercept field gets, sets, and deletes. It also defines its own iterator logic to customize the behavior of for ... of loops, guaranteeing that programs will iterate over the expected key/value pairs.

However, dom.Struct does not override the behavior of for ... in loops (i.e. property enumeration). While these are not commonly used with Objects, they are used in the implementation of Object.entries(), which is more popular.

I believe we can achieve the desired effect by providing an implementation of the ownKeys trap.

zslayton avatar Sep 15 '20 13:09 zslayton