fix chrom memory leak
This commit is contained in:
parent
20429670b8
commit
703bd033f6
@ -2445,10 +2445,10 @@
|
|||||||
};
|
};
|
||||||
imgHover = {
|
imgHover = {
|
||||||
init: function() {
|
init: function() {
|
||||||
imgHover.img = $.el('img', {
|
imgHover.el = $.el('div', {
|
||||||
id: 'iHover'
|
id: 'iHover'
|
||||||
});
|
});
|
||||||
$.append(d.body, imgHover.img);
|
$.append(d.body, imgHover.el);
|
||||||
return g.callbacks.push(imgHover.node);
|
return g.callbacks.push(imgHover.node);
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
@ -2458,14 +2458,23 @@
|
|||||||
}
|
}
|
||||||
$.bind(thumb, 'mouseover', imgHover.mouseover);
|
$.bind(thumb, 'mouseover', imgHover.mouseover);
|
||||||
$.bind(thumb, 'mousemove', ui.hover);
|
$.bind(thumb, 'mousemove', ui.hover);
|
||||||
return $.bind(thumb, 'mouseout', ui.hoverend);
|
return $.bind(thumb, 'mouseout', imgHover.mouseout);
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
/*
|
/*
|
||||||
`img.src = null` doesn't actually null the previous image on chrom.
|
http://code.google.com/p/chromium/issues/detail?id=36142
|
||||||
*/ imgHover.img.src = null;
|
manipulating img src via javascript will generate a massive memory leak
|
||||||
imgHover.img.src = this.parentNode.href;
|
|
||||||
return ui.el = imgHover.img;
|
instead of manipulating src, we manipulate the entire img
|
||||||
|
*/ var img;
|
||||||
|
img = $.el('img', {
|
||||||
|
src: this.parentNode.href
|
||||||
|
});
|
||||||
|
$.append(imgHover.el, img);
|
||||||
|
return ui.el = imgHover.el;
|
||||||
|
},
|
||||||
|
mouseout: function(e) {
|
||||||
|
return $.rm(imgHover.el.firstChild);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imgPreloading = {
|
imgPreloading = {
|
||||||
|
|||||||
@ -1847,21 +1847,26 @@ nodeInserted = (e) ->
|
|||||||
|
|
||||||
imgHover =
|
imgHover =
|
||||||
init: ->
|
init: ->
|
||||||
imgHover.img = $.el 'img', id: 'iHover'
|
imgHover.el = $.el 'div', id: 'iHover'
|
||||||
$.append d.body, imgHover.img
|
$.append d.body, imgHover.el
|
||||||
g.callbacks.push imgHover.node
|
g.callbacks.push imgHover.node
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
return unless thumb = $ 'img[md5]', root
|
return unless thumb = $ 'img[md5]', root
|
||||||
$.bind thumb, 'mouseover', imgHover.mouseover
|
$.bind thumb, 'mouseover', imgHover.mouseover
|
||||||
$.bind thumb, 'mousemove', ui.hover
|
$.bind thumb, 'mousemove', ui.hover
|
||||||
$.bind thumb, 'mouseout', ui.hoverend
|
$.bind thumb, 'mouseout', imgHover.mouseout
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
###
|
###
|
||||||
`img.src = null` doesn't actually null the previous image on chrom.
|
http://code.google.com/p/chromium/issues/detail?id=36142
|
||||||
|
manipulating img src via javascript will generate a massive memory leak
|
||||||
|
|
||||||
|
instead of manipulating src, we manipulate the entire img
|
||||||
###
|
###
|
||||||
imgHover.img.src = null
|
img = $.el 'img', src: @parentNode.href
|
||||||
imgHover.img.src = @parentNode.href
|
$.append imgHover.el, img
|
||||||
ui.el = imgHover.img
|
ui.el = imgHover.el
|
||||||
|
mouseout: (e) ->
|
||||||
|
$.rm imgHover.el.firstChild
|
||||||
|
|
||||||
imgPreloading =
|
imgPreloading =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user