Overriding Map/etc with get/set hooks?

Sam Tobin-Hochstadt samth at ccs.neu.edu
Tue May 21 03:22:56 PDT 2013

On Tue, May 21, 2013 at 3:09 AM, Anne van Kesteren <annevk at annevk.nl> wrote:
> On Tue, May 21, 2013 at 11:01 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> No, you don't need to do anything differently.  Conceptually, there
>> are three things you need:
>> 1. When the Map is created, before it's handed to the program, some
>> items are added.
>> 2. Some platform operations also change this map in addition to doing
>> the other things they do.
>> 3. Some other set of platform operations consult this map when doing
>> their other work.
>> Obviously, this is the spec perspective; an implementation could have
>> some magic version of the Map that does the update of the internal
>> platform state eagerly when map.set() is called.
> How does that ensure that e.g.
>   map.set("var-" + somethingNotAllowedByCSS, "test")
> throws / is ignored (forgot what the desired semantic is)? Or
>   map.set("var-test", {toString:function(){return"test")})
>   map.get("var-test")
> returns "test"?

If the plan is to do that, then you should _not_ use Map.  That isn't a Map.

But why do you want to do this?  Why not just have the CSS side ignore
properties with bad names/values?


More information about the es-discuss mailing list