IE 11 AngularJS error - Object doesn't support property or method 'from'

前端 未结 4 1040
一生所求
一生所求 2021-01-13 02:46

In my JavaScript I have a function detectEnvironmentAndGetLEAndDepot() which is called onload via HTML. I\'m working with wicket, and need to take

相关标签:
4条回答
  • 2021-01-13 03:09

    You could use an ES2015 polyfill, like es6-shim, Array.from or Babel polyfill

    0 讨论(0)
  • 2021-01-13 03:13

    you can use instead _underscore.js with function _.toArray(document.getElementsByTagName('span'))...

    FYI:

    'Array.from' not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

    source

    0 讨论(0)
  • 2021-01-13 03:21

    As explained by Mozilla here, the Array.from function is not yet supported by IE

    0 讨论(0)
  • 2021-01-13 03:30

    As Array.from method is not supported by IE, you can try to use:

    [].slice.call(document.getElementsByTagName('span')).forEach(function(v) {});
    

    This doesn't require usage of any 3rd party libraries.

    0 讨论(0)
提交回复
热议问题