custom-attributes icon indicating copy to clipboard operation
custom-attributes copied to clipboard

Browser Compatibility

Open bedeoverend opened this issue 7 years ago • 6 comments

Currently custom-attributes doesn't specify what browsers it supports, so thought it might be worth discussing what to aim for.

I've been using it in https://github.com/simplaelements/simpla-paths and that's been running well in everything bar IE - IE11 is missing a few WeakMap / Map features e.g. map.keys(). I'm also transpiling it, so languages features are all fine.

@matthewp thoughts?

bedeoverend avatar Apr 07 '17 01:04 bedeoverend

I didn't design it with specific browser targets. MutationObserver is the one thing that we can't live without so I guess IE11 is the absolute minimum. If it's down to Map/WeakMap those can be polyfilled (kinda), so is it just a matter of documenting?

matthewp avatar Apr 07 '17 01:04 matthewp

By the way, I don't know how you feel but I'm against libraries shipping with polyfills. I think it adds unnecessary cost that not all usages need. I think it's better just to be upfront and say "will work in IE11 if you include a Map/WeakMap polyfill".

matthewp avatar Apr 07 '17 01:04 matthewp

Yeah I agree, generally don't think polyfills should get shipped with libraries. The only features that IE11 doesn't have that are currently needed are keys()and values(), which this uses just on Map. It would be nice to support IE11 out of the box, though I'm guessing using Array lookups would really hurt perf?

Other than that - what do you think about having a transpiled version? Or alternatively update it to use ES5 to support IE11.

bedeoverend avatar Apr 07 '17 01:04 bedeoverend

Or, obviously other option re: transpilation is just let people transpile themselves when they use it in their own projects.

bedeoverend avatar Apr 07 '17 01:04 bedeoverend

See https://github.com/matthewp/custom-attributes/pull/13 - that gives support for IE11. I realised that IE11 just has partial support for Map / WeakMap, so it meant tweaking usage slightly to get it to work.

bedeoverend avatar Apr 30 '17 04:04 bedeoverend

Sounds good. Would be nice to set up SauceLabs or something for browser testing.

matthewp avatar Apr 30 '17 15:04 matthewp