Skip to main content

Search and Top Navigation

Ticket #4906: ie6-memoryleak.html
File ie6-memoryleak.html, 2.3 KB (added by tebulin, November 18, 2009 11:17AM UTC)

Automatic Demonstration of IE6 memory leakage (only subtle in testcase, but major in real life env)

<HTML>
<HEAD>
    <title>jQuery UI Datepicker - Demonstrate IE6 Leak</title>
    <!--<script type="text/javascript" src="../jquery/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="jquery-ui-1.7.2.custom.js"></script>-->

    <link type="text/css" href="http://jqueryui.com/themes/base/ui.all.css" rel="stylesheet" />
    <script type="text/javascript" src="http://jqueryui.com/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="http://jqueryui.com/ui/ui.core.js"></script>
    <script type="text/javascript" src="http://jqueryui.com/ui/ui.datepicker.js"></script>

    <script type="text/javascript">
        var run = true;

        function destroyPicker() {
            $("#datepicker").hide();
            $("#datepicker").datepicker('destroy');
            setTimeout(createPicker, 150);
        }

        function createPicker() {
            $("#datepicker").show();
            $("#datepicker").datepicker({duration : ''} );
            setTimeout(focusPicker, 150);
        }

        function focusPicker() {
            $("#datepicker").focus();
            setTimeout(focusInput, 300);
        }

        function focusInput() {
            // Fake a click outside datepicker
            $("#fakeinput").click();
            $("#fakeinput").mousedown();

            if (run) {
                setTimeout(destroyPicker, 300);
            }
        }

        $(function() { // body.onload
            createPicker();
        });
    </script>
</HEAD>


<body>

<div class="demo">
    <p align="center">Date: <input type="text" id="datepicker"></p>
    <p>Just a fake input: <input type="text" id="fakeinput"></p>
    <p><input type="button" value="Abort loop" onclick="javascript:run=false;"/></p>
    <p><input type="button" value="GarbageCollect (IE only)" onclick="javascript:CollectGarbage();"/></p>

</div>

<div class="demo-description">

    <p>The datepicker is tied to a standard form input field. Focus on the input
        (click, or use the tab key) to open an interactive calendar in a small overlay.
        Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close.
        If a date is chosen, feedback is shown as the input's value.</p>

</div>

</body>
</HTML>

Download in other formats:

Original Format