Opened 6 years ago

Closed 6 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:


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

        <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>
            $(document).ready(function () { $("body").offset(1) } );

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 6 years ago by scott.gonzalez

  • Component changed from ui.core to ui.position
  • Milestone changed from TBD to 1.8
  • Resolution set to fixed
  • Status changed from new to closed

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.