Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#6689 closed bug (duplicate)

javascriptmvc dynamic load problem

Reported by: qpi Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.6
Keywords: Cc:
Blocked by: Blocking:

Description

I'd like to use the ui.dialog in javascriptmvc framework (http://www.javascriptmvc.com). The framework loads it dynamically with include.resources('jquery.ui.dialog'), when the loader loaded the ui.dialog, recieves an error message: 'too much recursion'. I've found the problem in the ui.dialog (line 60) and when I changed the code from "of: window" to "of: document.window" the loader works perfectly. Please fix this issue for the lazy load and for keeping the JQuery UI compatibily with the Javascriptmvc framework.

Change History (6)

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

Do you happen to be using an older version of jQuery? #6030 already documents that dialogs don't currently work with jQuery 1.3.2 because of jQuery.extend().

comment:2 Changed 12 years ago by qpi

The javascriptmvc 2.0 uses jquery 1.3.2. I tried the test link in ticket (6030), it throws a similar error message, but I downloaded this test page and changed the minimized jquery 1.3.2 and jquery-ui 1.8.4 to the uncompressed version and and I've changed the line for what I wrote in this ticket (6030). The result: The test page works fine, the dialog box appears on the page. I uploaded this modified test page to the link below. Please try it!

http://rapidshare.com/files/432798190/test.zip

comment:3 Changed 12 years ago by qpi

I tried my modifications in my project and the dialog position does not work correctly, it always drops the dialog into top-left of the window. I take another modification in the ui.dialog, I've changed the "of: document.window" to "of: document" and the position works fine.

comment:4 Changed 12 years ago by qpi

My previous comment isn't completely a good fix for this issue, because when the position.of = document and the page height is larger than the window (when the right scrollbar appears), the vertical position is not good.
I think the ui.position fails when the ui.position 'of' option's value is 'window'.
My solution for this issue:
The ui.position 'of' option is shouldn't be mandatory option. The default 'of' option should to be 'window'. In this case the jQuery.extend() does not extend the infinity deep 'window' object

/**
 * Add the default value to the 'options.of'
 * jquery.ui.position.js (modified) (from line 20):
 */
$.fn.position = function( options ) {
if ( !options ) {
	return _position.apply( this, arguments );
}
if ( !options.of ) {
	options.of = window;	
}
...
/**
 * Remove 'of' option from the position's options
 * jquery.ui.dialog.js (modified) (from line 57):
 */
position: {
	my: 'center',
	at: 'center',
	//of: window,
	collision: 'fit',
...

comment:5 Changed 12 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:6 Changed 12 years ago by Scott González

Duplicate of #6030.

Note: See TracTickets for help on using tickets.