2013-07-01 72 views
0

我在与IE8不附加我想要的元素的问题,请参见下面IE8不追加对象

咖啡

testSite.create_featured_related_product = (modifier) -> 
    __link = $('<a href="#">') 
    __img = $('<img src="http://localhost:9000/img/img.png"/>') 
    __link.append(__img) 
    $('.product-relation__group-' + modifier).prepend (__link) 
@ 

代码的Javascript

testSite.create_featured_related_product = function(modifier) { 
    var __img, __link; 
    __link = $('<a href="#">'); 
    __img = $('<img src="http://localhost:9000/img/img.png"/>'); 
    __link.append(__img); 
    $('.product-relation__group-' + modifier).prepend(__link); 
    return this; 
}; 

上述内容(<a><img>)都没有附加到t他<div class="group">。 我从IE8控制台得到的错误是:

'undefined' is null or not an object jquery-with-plugs__0.3.1.js, line 963 character 13 

该行似乎是jQuery的一部分,并表示

"inprogress" === e && (e = c.shift(), d--), f.cur = e, e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire() 

在上下文中的错误:

}), ib.extend({ 
    queue: function (a, c, d) { 
     var e; 
     return a ? (c = (c || "fx") + "queue", e = ib._data(a, c), d && (!e || ib.isArray(d) ? e = ib._data(a, c, ib.makeArray(d)) : e.push(d)), e || []) : b 
    }, 
    dequeue: function (a, b) { 
     b = b || "fx"; 
     var c = ib.queue(a, b), 
      d = c.length, 
      e = c.shift(), 
      f = ib._queueHooks(a, b), 
      g = function() { 
       ib.dequeue(a, b) 
      }; 
     "inprogress" === e && (e = c.shift(), d--), f.cur = e, e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire() 
    }, 
    _queueHooks: function (a, b) { 
     var c = b + "queueHooks"; 
     return ib._data(a, c) || ib._data(a, c, { 
      empty: ib.Callbacks("once memory").add(function() { 
       ib._removeData(a, b + "queue"), ib._removeData(a, c) 
      }) 
     }) 
    } 

任何想法?编辑:简化代码

+0

你可以从调用堆栈中弄出什么代码会导致错误吗? – HMR

+0

@HMR当然!我用调用堆栈编辑了我的问题。 –

回答

0

问题是IE8的处理附加。不是jQuery错误。