zambezi / grid

D3 component for drawing grids
MIT License
4 stars 2 forks source link

Datasets; part of the IE10 compatibility viacrucis #29

Closed gabrielmontagne closed 7 years ago

gabrielmontagne commented 7 years ago

Description

Makes the grid revert to data-whatever-attribute when node.dataset is not available.

Motivation and Context

The grid doesn't pretend to run everywhere -- it's the responsibility of the app in which this is to be embedded to cater for transpilations, perspirations and polyfillings which, we'd guess, are needed not only for this component.

But while most of the modern JS usage can be fixed at build time using something like babel-polyfill, some things remain run time pastimes.

At The Office:tm: we had two problems that forced us to lay hands on our pre-compiled code (actually only one main problem, IE10 support, but... )

  1. D3v4 dispatch of native dom events in IE -- we had to add a good old polyfill to our app.
  2. The dataset incompatibility, which cannot really be addressed "once and for all", but needed to be, sad but true, embedded on the grid.

Hence this PR.

Smarter people might find a nicer solution. Please? Anyways, for now, if you don't mind....

How Was This Tested?

To properly test this we created a (still offline) fully webpacked build with polyfills, etc. to run this on IE. Nothing we can easily upload to a block

Types of changes

Checklist:

gabrielmontagne commented 7 years ago

@grancalavera ... so far like this goes the var.

Poetro commented 7 years ago

There are polyfills for ES5 browsers like element-dataset, so I don't think it is necessary to hack around this.

gabrielmontagne commented 7 years ago

I'll take it for a spin -- tho... well, let's see : )

gabrielmontagne commented 7 years ago

Yeah, tried that out, even the one you suggested -- but, as I feared, until JS Proxies are supported -- that is, never for good old IE, there is no way that doing node.dataset.heyPeter = 5 can be turned into <node data-hey-peter="5" />

So, I think, we should bring in this ponyfill in until -- ?

cristiano-belloni commented 7 years ago

Also, I'd be wary of bringing in a polyfill using proxies. Might be my superstition, but I heard they're slow as hell (is hell slow?)

gabrielmontagne commented 7 years ago

hell is slow; I've seen it: F12 => Emulation => 10