Skip to content
Browse files
Dialog: Set the type on buttons. Fixes #6128 - Dialog: Buttons are no…
…t type="button".
  • Loading branch information
scottgonzalez committed Sep 30, 2010
1 parent a2ddfd5 commit cd7f10d480c923d095af6cbd844cbbdb5bb3813e
Showing with 1 addition and 1 deletion.
  1. +1 −1 ui/jquery.ui.dialog.js
@@ -376,7 +376,7 @@ $.widget("ui.dialog", {
props = $.isFunction( props ) ?
{ click: props, text: name } :
var button = $('<button></button>', props)
var button = $('<button type="button"></button>', props)

This comment has been minimized.

Copy link

jitter Sep 30, 2010

This will trigger this error in all browsers doc.createDocumentFragment is not a function

as jQuery( html, props ) isn't built to be used in this way (jQuery( html, props )). The docs describe the html parameter as

html A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).

Passing in as html anything other (complex html, not single standalone tag e.g as above with "inline" attributes) while the second parameter (as in this case) isn't a context but a map of attributes will trigger the above exception.

As simply doing { click: props, text: name, type: "button" } and $('<button></button>', props) won't work, due to IE not allowing to change the type after the button has been created, I propose this alternative fix

var button = $('<button type="button"></button>')
             .attr(props, true)

This comment has been minimized.

Copy link

scottgonzalez Oct 1, 2010

Author Member

Thanks, Fixed in d7670b9.

.click(function() {[0], arguments);

0 comments on commit cd7f10d

Please sign in to comment.