Permalink
Browse files

addFirstLastClasses: .not( ".ui-screen-hidden" ) -> custom function

  • Loading branch information...
gabrielschulhof committed Mar 8, 2014
1 parent 3d85609 commit 7b818d8e2ed234de6316bb63521828cdd95da2cc
Showing with 17 additions and 2 deletions.
  1. +17 −2 js/widgets/addFirstLastClasses.js
@@ -7,16 +7,31 @@ define( [ "jquery", "../core" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
function noHiddenClass( elements ) {
var index,
length = elements.length,
result = [];
for ( index = 0; index < length; index++ ) {
if ( !elements[ index ].className.match( uiScreenHiddenRegex ) ) {
result.push( elements[ index ] );
}
}
return $( result );
}
$.mobile.behaviors.addFirstLastClasses = {
_getVisibles: function( $els, create ) {
var visibles;
if ( create ) {
visibles = $els.not( ".ui-screen-hidden" );
visibles = noHiddenClass( $els );
} else {
visibles = $els.filter( ":visible" );
if ( visibles.length === 0 ) {
visibles = $els.not( ".ui-screen-hidden" );
visibles = noHiddenClass( $els );
}
}

0 comments on commit 7b818d8

Please sign in to comment.