d3plus / d3plus-text

A smart SVG text box with line wrapping and automatic font size scaling.
MIT License
105 stars 19 forks source link

Replace includes with indexOf in fontExists to make it compatible with IE11 #84

Closed lukasm93 closed 6 years ago

lukasm93 commented 6 years ago

TypeError: Object doesn't support property or method 'includes' at fontExists

Expected Behavior

Replace includes(fam) in src/fontExists.js in l.29 with indexOf(fam) !== -1 as "includes" is not supported by IE11, current core-js polyfills don't seem to solve the issue for Angular 4 and 5.

Current Behavior

IE11 is not able to render the text nodes.

Your Environment

Angular Core: 4.4.6 Angular Compiler CLI: 4.4.6 Node: 8.11.1 Navigator Platform: Win32 Browser: Internet Explorer 11.0.9600

davelandry commented 6 years ago

We use includes throughout a lot of our code, and I prefer to keep using a polyfill for older browsers. The one we use for vanilla JS builds of d3plus was taken from here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Polyfill

@lukasm93 which polyfill are you using?

lukasm93 commented 6 years ago

Sorry, that was my fault, importing core-js/es7/array to my polyfills fixes the issue. I accidentally imported only es6.

Still I guess it's worth thinking about it as indexOf is supported by all browsers.