Skip to main content

Search and Top Navigation

#3012 closed bug (fixed)

Opened June 17, 2008 09:46PM UTC

Closed June 28, 2008 09:09PM UTC

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!

Attachments (0)
Change History (3)

Changed June 19, 2008 06:26PM UTC by paul comment:1

owner: paulrdworth
status: newassigned

Changed June 26, 2008 07:54PM UTC by rdworth comment:2

milestone: 1.51.5.2

Changed June 28, 2008 09:09PM UTC by rdworth comment:3

resolution: → fixed
status: assignedclosed

fixed in [384]