Opened 15 years ago

Closed 15 years ago

#3012 closed bug (fixed)

Dialog causing iframe load event to fire in firefox 2

Reported by: bgrinstead Owned by: rdworth
Priority: major Milestone: 1.5.2
Component: ui.core Version: 1.5
Keywords: dialog iframe Cc:
Blocked by: Blocking:

Description

I have noticed that in firefox, if you call dialog("open") and the element inside the dialog is an iframe, the load event gets called each time (only in Firefox). Here is some example code:

<body>
<div id='iContainer'></div>
<input type='button' id='showDialog' value='show dialog' />
<script>

var numLoads = 0;

$(function() {
	var iframe= document.createElement( "iframe" );
	$(iframe).load(function() {
		numLoads++;
		$("iframe").contents().find("body").html("Loaded " + numLoads + " times.");
	})
	$("#iContainer").append($(iframe));
	
	$("#showDialog").click(function() {
		$("#iContainer").dialog("open");
	});
	
	$("#iContainer").dialog({resizable:false, draggable:false});
});

</script>
</body>

Here, the counter gets incremented each time in Firefox, but stays the same in IE. I have also noticed that if I comment out the line:

//this.uiDialog.appendTo('body'); this line was causing iframe load event to fire again

in the open function here:

open: function() {
		this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
		this.element.triggerHandler("dialogopen", [openEV, openUI], this.options.open);
		//this.uiDialog.appendTo('body');

...

Then it doesn't do it anymore. I haven't noticed this breaking anything in my case, but I have to imagine that the appendTo function call is there for a reason. Any ideas? Thanks!

Change History (3)

comment:1 Changed 15 years ago by paul

Owner: changed from paul to rdworth
Status: newassigned

comment:2 Changed 15 years ago by rdworth

Milestone: 1.51.5.2

comment:3 Changed 15 years ago by rdworth

Resolution: fixed
Status: assignedclosed

fixed in [384]

Note: See TracTickets for help on using tickets.