Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Page.dialog: remove close function and isClosable prop use regular ba…
Browse files Browse the repository at this point in the history
…ck button Fixes #6609 - widgets/page.dialog: Remove function close() and modify "Back" button to have data-rel="back"
  • Loading branch information
arschmitz committed Oct 15, 2013
1 parent fdda872 commit 677c0d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
22 changes: 1 addition & 21 deletions js/widgets/page.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ $.widget( "mobile.page", $.mobile.page, {
if ( this.options.dialog ) {

$.extend( this, {
_isCloseable: false,
_inner: this.element.children(),
_headerCloseButton: null
});
Expand Down Expand Up @@ -115,35 +114,16 @@ $.widget( "mobile.page", $.mobile.page, {
} else {
dst = this._inner.find( ":jqmData(role='header')" ).first();
btn = $( "<a></a>", {
"role": "button",
"href": "#",
"class": "ui-btn ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-" + location
})
.attr( "data-" + $.mobile.ns + "rel", "back" )
.text( text || this.options.closeBtnText || "" )
.prependTo( dst );
this._on( btn, { click: "close" } );
}

this._headerCloseButton = btn;
},

// Close method goes back in history
close: function() {
var idx, dst, hist = $.mobile.navigate.history;

if ( $.mobile.hashListeningEnabled && hist.activeIndex > 0 ) {
$.mobile.back();
} else {
idx = Math.max( 0, hist.activeIndex - 1 );
dst = hist.stack[ idx ].pageUrl || hist.stack[ idx ].url;
hist.previousIndex = hist.activeIndex;
hist.activeIndex = idx;
if ( !$.mobile.path.isPath( dst ) ) {
dst = $.mobile.path.makeUrlAbsolute( "#" + dst );
}

$.mobile.changePage( dst, { direction: "back", changeHash: false, fromHashChange: true } );
}
}
});

Expand Down
6 changes: 1 addition & 5 deletions tests/integration/dialog-extension/dialog_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
});

asyncTest( "Test option data-close-btn", function() {
expect( 7 );
expect( 5 );

$.testHelper.pageSequence([
function() {
Expand All @@ -29,15 +29,11 @@
a = $( "#close-btn-test .ui-header a" );
deepEqual( a.length, 1, "The dialog header has eactly one anchor element when the option value is set to 'left'" );
ok( a.hasClass( "ui-btn-left" ), "The close button has class ui-btn-left when the closeBtn option is set to 'left'" );
deepEqual( a.attr( "role" ), "button", "The close button has the attribute " + '"' + "role='button'" + '"' + "set" );

$( "#close-btn-test" ).page( "option", "closeBtn", "right" );
a = $( "#close-btn-test .ui-header a" );
deepEqual( a.length, 1, "The dialog header has eactly one anchor element when the option value is set to 'right'" );
ok( a.hasClass( "ui-btn-right" ), "The close button has class ui-btn-right when the closeBtn option is set to 'right'" );
deepEqual( a.attr( "role" ), "button", "The close button has the attribute " + '"' + "role='button'" + '"' + "set" );


},

function() {
Expand Down

0 comments on commit 677c0d8

Please sign in to comment.