Skip to main content

Search and Top Navigation

#6689 closed bug (duplicate)

Opened November 23, 2010 02:59PM UTC

Closed November 26, 2010 03:02AM UTC

Last modified November 26, 2010 03:02AM UTC

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.

Attachments (0)
Change History (6)

Changed November 23, 2010 03:17PM UTC by scottgonzalez comment:1

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().

Changed November 24, 2010 09:05AM UTC by qpi comment:2

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

Changed November 24, 2010 03:38PM UTC by qpi comment:3

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.

Changed November 25, 2010 12:31PM UTC by qpi comment:4

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',
...

Changed November 26, 2010 03:02AM UTC by scottgonzalez comment:5

resolution: → duplicate
status: newclosed

Changed November 26, 2010 03:02AM UTC by scottgonzalez comment:6

Duplicate of #6030.