IE9内存泄漏

时间:2012-05-07 23:05:12

标签: javascript jquery internet-explorer-9

我正在使用sIEve检查ASP MVC网站中的内存泄漏。 sIEve告诉我,我的一个页面有,但我不知道如何使用sIEve提供的信息来开始解决一些泄漏。

例如,在下面的screen shot中,我看到ID为“twitter-link”的A标签有泄漏,在我的代码中我有以下内容:

$("#twitter-link").click(function () {
                        $.cookie(cookieName, cookieValue);
                        popup("Twitter", "http://twitter.com/MyWebSite", 568, 1006);
                    });


function popup(source, url, height, width, callback) {
    settings = {
        height: 568, // sets the height in pixels of the window.
        width: 1006, // sets the width in pixels of the window.
        toolbar: 0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
        scrollbars: 1, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
        status: 0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
        resizable: 1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
        left: 0, // left position when the window appears.
        top: 0, // top position when the window appears.
        center: 1, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
        createnew: 1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
        location: 0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
        menubar: 0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
        onUnload: null // function to call when the window is closed
    };
    if (settings.center == 1) {
        if ($.browser.msie) {//hacked together for IE browsers
            centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (settings.height / 2)));
            centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (settings.width / 2)));
        } else {
            centeredY = window.screenY + (((window.outerHeight / 2) - (settings.height / 2)));
            centeredX = window.screenX + (((window.outerWidth / 2) - (settings.width / 2)));
        }
        settings.top = centeredY; //(screen.height-(settings.height + 110))/2;
        settings.left = centeredX; // (screen.width-settings.width)/2;
    }
    parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left + ",screenX=" + settings.left + ",top=" + settings.top + ",screenY=" + settings.top;

    var popup = window.open(url, source, parameters);
    var popuptimer = setInterval(function () {
        if (popup.closed) {
            clearInterval(popuptimer);
            if (callback)
                callback.call();
        }
    }, 1000);
}



<li><a id="twitter-link" href="javascript:void(0);"><img alt="Twitter" title="Twitter" src="twitter.png" />follow us on twitter</a></li>

我不明白“twitter-link”是如何导致泄密的,所以我的问题是,如何使用sIEve提供的信息来消除泄漏?

提前感谢您的帮助。

0 个答案:

没有答案