regularjs / regular

regularjs: a living template engine that helps us to create data-driven component.
http://regularjs.github.io/
MIT License
1.06k stars 149 forks source link

[急]IE模式,Regular报源码错误。 #183

Closed lolipop99 closed 7 years ago

lolipop99 commented 7 years ago

如题,麻烦Regular相关工作人员排查一下。谢谢 image

image

定位源码位置: image

lolipop99 commented 7 years ago

@leeluolee

Mrlilili commented 7 years ago

@leeluolee +1出现问题

lolipop99 commented 7 years ago

@Mrlilili 波哥已经临时给了个解决方案 在引入Regular后 加入这段

var dom = Regular.dom;
dom.text = (function (){
  var map = {};
  if (dom.msie && dom.msie < 9) {
    map[1] = 'innerText';    
    map[3] = 'nodeValue';    
  } else {
    map[1] = map[3] = 'textContent';
    try{
        var text = document.createTextNode('');
        text.textContent = 'void';
    }catch(e){
        map[1] = 'innerText';    
        map[3] = 'nodeValue';    
    }
  }

  return function (node, value) {
    var textProp = map[node.nodeType];
    if (value == null) {
      return textProp ? node[textProp] : '';
    }
    node[textProp] = value;
  }
})();

RegularJS下个版本会解决这问题。