mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Remove attroperty workaround for title attribute. Make the default null, as it should be. No back-compat, as the behaviour doesn't change.
This commit is contained in:
parent
f7d3a51589
commit
6edce86733
@ -23,7 +23,7 @@ TestHelpers.commonWidgetTests( "dialog", {
|
|||||||
},
|
},
|
||||||
resizable: true,
|
resizable: true,
|
||||||
show: null,
|
show: null,
|
||||||
title: '',
|
title: null,
|
||||||
width: 300,
|
width: 300,
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
|
@ -416,7 +416,7 @@ test("resizable", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "title", function() {
|
test( "title", function() {
|
||||||
expect(9);
|
expect( 11 );
|
||||||
|
|
||||||
function titleText() {
|
function titleText() {
|
||||||
return el.dialog('widget').find( ".ui-dialog-title" ).html();
|
return el.dialog('widget').find( ".ui-dialog-title" ).html();
|
||||||
@ -426,7 +426,7 @@ test("title", function() {
|
|||||||
// some browsers return a non-breaking space and some return " "
|
// some browsers return a non-breaking space and some return " "
|
||||||
// so we generate a non-breaking space for comparison
|
// so we generate a non-breaking space for comparison
|
||||||
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
||||||
equal(el.dialog("option", "title"), "", "option not changed");
|
equal( el.dialog( "option", "title" ), null, "option not changed" );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $( '<div title="foo">' ).dialog();
|
el = $( '<div title="foo">' ).dialog();
|
||||||
@ -447,6 +447,14 @@ test("title", function() {
|
|||||||
el = $( '<div></div>' ).dialog().dialog( 'option', 'title', 'foo' );
|
el = $( '<div></div>' ).dialog().dialog( 'option', 'title', 'foo' );
|
||||||
equal( titleText(), 'foo', 'title after init' );
|
equal( titleText(), 'foo', 'title after init' );
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
|
// make sure attroperties are properly ignored - #5742 - .attr() might return a DOMElement
|
||||||
|
el = $( '<form><input name="title"></form>' ).dialog();
|
||||||
|
// some browsers return a non-breaking space and some return " "
|
||||||
|
// so we get the text to normalize to the actual non-breaking space
|
||||||
|
equal( titleText(), $( "<span> </span>" ).html(), "[default]" );
|
||||||
|
equal( el.dialog( "option", "title" ), null, "option not changed" );
|
||||||
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("width", function() {
|
test("width", function() {
|
||||||
|
9
ui/jquery.ui.dialog.js
vendored
9
ui/jquery.ui.dialog.js
vendored
@ -67,7 +67,7 @@ $.widget("ui.dialog", {
|
|||||||
},
|
},
|
||||||
resizable: true,
|
resizable: true,
|
||||||
show: null,
|
show: null,
|
||||||
title: "",
|
title: null,
|
||||||
width: 300,
|
width: 300,
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
@ -85,16 +85,11 @@ $.widget("ui.dialog", {
|
|||||||
|
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.originalTitle = this.element.attr( "title" );
|
this.originalTitle = this.element.attr( "title" );
|
||||||
// #5742 - .attr() might return a DOMElement
|
this.options.title = this.options.title || this.originalTitle;
|
||||||
// TODO WTF?
|
|
||||||
if ( typeof this.originalTitle !== "string" ) {
|
|
||||||
this.originalTitle = "";
|
|
||||||
}
|
|
||||||
this.oldPosition = {
|
this.oldPosition = {
|
||||||
parent: this.element.parent(),
|
parent: this.element.parent(),
|
||||||
index: this.element.parent().children().index( this.element )
|
index: this.element.parent().children().index( this.element )
|
||||||
};
|
};
|
||||||
this.options.title = this.options.title || this.originalTitle;
|
|
||||||
var that = this,
|
var that = this,
|
||||||
options = this.options,
|
options = this.options,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user