Skip to main content

Search and Top Navigation

#8983 closed bug (cantfix)

Opened January 18, 2013 03:38PM UTC

Closed January 18, 2013 05:23PM UTC

Creating dialog with buttons causes jQuery 1.9 migrate warning

Reported by: fedot Owned by:
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:
Description

When jQuery UI 1.10.0 is used in combination with jQuery 1.9 and Migrate 1.0.0 plugin to create a dialog that has some buttons, the following warning is generated by the Migrate plugin:

JQMIGRATE: Can't change the 'type' of an input or button in IE 6/7/8

The cause of this warning is the way jQuery UI creates buttons. Looking into the sources, jquery.ui.dialog.js, around line 409:

// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
....
$( "<button></button>", props )

This causes the change of button type from its default 'submit' which now violates jQuery 1.9 compatibility.

Here is a test case (enable your debugging console to see the warning):

http://jsfiddle.net/uu6pd/

Perhaps, the easiest way to fix it would be as follows:

$( '<button type="button"></button>', props )
Attachments (0)
Change History (1)

Changed January 18, 2013 05:23PM UTC by dmethvin comment:1

resolution: → cantfix
status: newclosed

This is definitely an issue in the jQuery Migrate plugin. By the time the plugin receives control it doesn't know that this is the special case where oldIE allows setting the type just *once*. To make things worse, you pretty much always have to set the type to make <button> work right, since oldIE makes them type="button" but other browsers use type="submit" by default.

I'll close this ticket and we'll track the issue in the plugin:

https://github.com/jquery/jquery-migrate/issues/12