Opened 13 years ago

Closed 13 years ago

#5041 closed bug (fixed)

Stack overflow when jquery-ui.js included twice

Reported by: glipman Owned by:
Priority: minor Milestone: 1.8
Component: ui.position Version: 1.8a2
Keywords: stack overflow twice Cc:
Blocked by: Blocking:

Description

The following small sample creates a 'Stack overflow error' in Internet Explorer (or makes IE even crash hard) with 1.8a2.

<html>
    <head>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="ui/jquery-ui.js"></script>
        <script type="text/javascript" src="ui/jquery-ui.js"></script>
        <script>
            $(document).ready(function () { $("body").offset(1) } );
        </script>
    </head>
<body>
    Hello
</body>
</html>

It is caused by the redefinition of the offset-function. The old definition is stored in a variable _offset but when the second include is processed the old definition is identical to the new definition causing infinite recursion.

As a workaround I obviously cleaned my code so the js is included only once.
However I think jQuery-ui should be more robust (not crash) when it is included twice.

Change History (1)

comment:1 Changed 13 years ago by Scott González

Component: ui.coreui.position
Milestone: TBD1.8
Resolution: fixed
Status: newclosed

The offset code in the 1.8 alphas was temporary (waiting for the offset setter code in jQuery 1.4). The new offset code was already landed in the dev branch and doesn't have this problem.

Note: See TracTickets for help on using tickets.