Directive not working in IE8

天大地大妈咪最大 提交于 2019-12-13 05:36:57

问题


I have a directive called barsMax and it is not working in IE8, even if I already placed:

<!--[if lte IE 8]> 
  <script> 
   document.createElement('bars-max'); 
  </script> 
<![endif]-->

What am I missing?


回答1:


Code you are using also has a pseudo tag bars-current.

Adding document.createElement('bars-current'); to your polyfill worked for me.

DISCLAMER : Am Using IE10 in IE8 standards mode but error thrown in console if don't create elements first and jsfiddle itself falls apart without it in IE8

DEMO Working version




回答2:


IE doesnt allow unfamiliar tags and therefor you may not use directives as tags like . you must use restrict "A" and use it as an attribute in a known html tag. if you dont want the wrapper tag use replace:true like this

return { restrict: 'A', replace:true, scope: ..., link:... you can see some examples about all that here https://skydrive.live.com/redir?resid=949DC4EDBFFD4738!189&authkey=!ABZCTBTTOCDYGhk

working version tested in ie8 native http://jsbin.com/IDOMuqU/2/edit (the not working version in ie8 native with the polyfills - http://jsbin.com/IDOMuqU/1/edit)



来源:https://stackoverflow.com/questions/19611280/directive-not-working-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!