2013-07-01 74 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錯誤。