Skip to content

Commit

Permalink
Popup: fixed too long code lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeluca committed Oct 17, 2014
1 parent cc6e6cd commit 51f427a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions js/widgets/popup.js
Expand Up @@ -298,7 +298,7 @@ $.widget( "mobile.popup", {
if ( targetElement !== ui.container[ 0 ] ) {
target = $( targetElement );
if ( !$.contains( ui.container[ 0 ], targetElement ) ) {
$( this.document[ 0 ].activeElement ).one( "focus", $.proxy( function(/* theEvent */) {
$( this.document[ 0 ].activeElement ).one( "focus", $.proxy( function() {
this._safelyBlur( targetElement );
}, this ) );
ui.focusElement.focus();
Expand Down Expand Up @@ -632,8 +632,9 @@ $.widget( "mobile.popup", {
},

_safelyBlur: function( currentElement ){
if (currentElement !== this.window[ 0 ] && currentElement.nodeName.toLowerCase() !== "body") {
$( currentElement ).blur();
if (currentElement !== this.window[ 0 ]
&& currentElement.nodeName.toLowerCase() !== "body") {
$( currentElement ).blur();
}
},

Expand Down
8 changes: 5 additions & 3 deletions tests/integration/popup/popup_core.js
Expand Up @@ -337,7 +337,8 @@
]);
});

// The test below adds an input, gives it focus, then open the popup, and make sure the input has been blurred.
// The test below adds an input, gives it focus, then open the popup,
// and make sure the input has been blurred.
asyncTest( "Popup assures previous element is blurred", function() {
var link = $( "#open-test-popup" ),
popup = $( "#test-popup" ),
Expand All @@ -357,7 +358,8 @@
},

function( result ){
deepEqual( document.activeElement, textinput[ 0 ], "Textinput focused before popup is opened" );
deepEqual( document.activeElement, textinput[ 0 ],
"Textinput focused before popup is opened" );
deepEqual( result.focus.timedOut, false );
popup.popup( "open" );
},
Expand All @@ -382,7 +384,7 @@
function( result ) {
deepEqual( result.focus.timedOut, false, "Focus event received" );
deepEqual( document.activeElement === textinput[ 0 ], false,
"An input outside the popup is prevented from receiving focus while the popup is open" );
"An input outside the popup does not receive focus while the popup is open" );
popup.popup( "close" );
},

Expand Down

0 comments on commit 51f427a

Please sign in to comment.