Ticket #3012 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 6 years ago by paul

  • Owner changed from paul to rdworth
  • Status changed from new to assigned

comment:2 Changed 6 years ago by rdworth

  • Milestone changed from 1.5 to 1.5.2

comment:3 Changed 6 years ago by rdworth

  • Status changed from assigned to closed
  • Resolution set to fixed

fixed in [384]

Note: See TracTickets for help on using tickets.