Permalink
Browse files

Coding standards: liberal spacing, functions go snug to front if it's…

… the only argument.
  • Loading branch information...
jaspermdegroot committed Jul 9, 2012
1 parent 01ad182 commit 4b9588381b1a1d33e2d6b1d7434bcfaaf32ce9c1
@@ -7,7 +7,7 @@
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.vmouse" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, undefined ) {
+(function( $, undefined ) {
$.fn.buttonMarkup = function( options ) {
var $workingSet = this,
@@ -233,10 +233,10 @@ var attachEvents = function() {
}
}
},
- "focusin focus": function( event ){
+ "focusin focus": function( event ) {
$( closestEnabledButton( event.target ) ).addClass( $.mobile.focusClass );
},
- "focusout blur": function( event ){
+ "focusout blur": function( event ) {
$( closestEnabledButton( event.target ) ).removeClass( $.mobile.focusClass );
}
});
@@ -246,7 +246,7 @@ var attachEvents = function() {
//links in bars, or those with data-role become buttons
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", e.target )
.not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
@@ -33,13 +33,13 @@ $.fn.controlgroup = function( options ) {
// Replace legend with more stylable replacement div
if ( groupheading.length ) {
- $( "<div role='heading' class='ui-controlgroup-label'>" + groupheading.html() + "</div>" ).insertBefore( $el.children(0) );
+ $( "<div role='heading' class='ui-controlgroup-label'>" + groupheading.html() + "</div>" ).insertBefore( $el.children( 0 ) );
groupheading.remove();
}
$el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction );
- flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not('.ui-slider-handle'), flCorners );
+ flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners );
flipClasses( $el.find( ".ui-btn-inner" ), flCorners );
if ( o.shadow ) {
View
@@ -125,12 +125,12 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
// prevent scrollstart and scrollstop events
$.event.special.scrollstart.enabled = false;
- setTimeout(function() {
+ setTimeout( function() {
window.scrollTo( 0, ypos );
$( document ).trigger( "silentscroll", { x: 0, y: ypos });
}, 20 );
- setTimeout(function() {
+ setTimeout( function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
@@ -185,8 +185,8 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
// doing a similar parent node traversal to the one found in the inherited theme code above
closestPageData: function( $target ) {
return $target
- .closest(':jqmData(role="page"), :jqmData(role="dialog")')
- .data("page");
+ .closest( ':jqmData(role="page"), :jqmData(role="dialog")' )
+ .data( "page" );
},
enhanceable: function( $set ) {
@@ -198,7 +198,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
},
haveParents: function( $set, attr ) {
- if( !$.mobile.ignoreContentEnabled ){
+ if ( !$.mobile.ignoreContentEnabled ) {
return $set;
}
@@ -230,7 +230,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
return $newSet;
},
- getScreenHeight: function(){
+ getScreenHeight: function() {
// Native innerHeight returns more accurate value for this across platforms,
// jQuery version is here as a normalized fallback for platforms like Symbian
return window.innerHeight || $( window ).height();
@@ -273,25 +273,25 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
$.removeWithDependents = function( elem ) {
var $elem = $( elem );
- ( $elem.jqmData('dependents') || $() ).remove();
+ ( $elem.jqmData( 'dependents' ) || $() ).remove();
$elem.remove();
};
$.fn.addDependents = function( newDependents ) {
- $.addDependents( $(this), newDependents );
+ $.addDependents( $( this ), newDependents );
};
$.addDependents = function( elem, newDependents ) {
- var dependents = $(elem).jqmData( 'dependents' ) || $();
+ var dependents = $( elem ).jqmData( 'dependents' ) || $();
- $(elem).jqmData( 'dependents', $.merge(dependents, newDependents) );
+ $( elem ).jqmData( 'dependents', $.merge( dependents, newDependents ) );
};
// note that this helper doesn't attempt to handle the callback
// or setting of an html elements text, its only purpose is
// to return the html encoded version of the text in all cases. (thus the name)
$.fn.getEncodedText = function() {
- return $( "<div/>" ).text( $(this).text() ).html();
+ return $( "<div/>" ).text( $( this ).text() ).html();
};
// fluent helper function for the mobile namespaced equivalent
@@ -1,5 +1,5 @@
// creates the define method on window, only used where async loading
// is not desired in the docs and experiments
-window.define = function(){
+window.define = function() {
Array.prototype.slice.call( arguments ).pop()( window.jQuery );
};
@@ -26,11 +26,11 @@ $.mobile.page.prototype.options.degradeInputs = {
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
- var page = $.mobile.closestPageData($(e.target)), options;
+ var page = $.mobile.closestPageData( $( e.target ) ), options;
- if( !page ) {
+ if ( !page ) {
return;
}
@@ -19,7 +19,7 @@ $.fn.fieldcontain = function( options ) {
};
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain();
});
View
@@ -15,9 +15,9 @@ $.fn.grid = function( options ) {
var $this = $( this ),
o = $.extend({
grid: null
- },options),
+ }, options ),
$kids = $this.children(),
- gridCols = {solo:1, a:2, b:3, c:4, d:5},
+ gridCols = { solo:1, a:2, b:3, c:4, d:5 },
grid = o.grid,
iterator;
View
@@ -7,13 +7,13 @@
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery.mobile.navigation",
"./jquery.mobile.navigation.pushstate", "./widgets/loader", "./jquery.mobile.vmouse", "depend!./jquery.hashchange[jquery]" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, window, undefined ) {
+(function( $, window, undefined ) {
var $html = $( "html" ),
$head = $( "head" ),
$window = $( window );
//remove initial build class (only present on first pageshow)
- function hideRenderingClass(){
+ function hideRenderingClass() {
$html.removeClass( "ui-mobile-rendering" );
}
@@ -40,7 +40,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// this ensures the rendering class is removed after 5 seconds, so content is visible and accessible
setTimeout( hideRenderingClass, 5000 );
- $.extend($.mobile, {
+ $.extend( $.mobile, {
// find and enhance the pages in the dom and transition to the first page.
initializePage: function() {
// find present pages
@@ -53,10 +53,10 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// add dialogs, set data-url attrs
$pages.each(function() {
- var $this = $(this);
+ var $this = $( this );
// unless the data url is already set set it to the pathname
- if ( !$this.jqmData("url") ) {
+ if ( !$this.jqmData( "url" ) ) {
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search );
}
});
@@ -106,21 +106,21 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
// it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)
// so if it's 1, use 0 from now on
- $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $(window).scrollTop() === 1 ) ? 0 : 1;
+ $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $( window ).scrollTop() === 1 ) ? 0 : 1;
// TODO: Implement a proper registration mechanism with dependency handling in order to not have exceptions like the one below
//auto self-init widgets for those widgets that have a soft dependency on others
if ( $.fn.controlgroup ) {
- $( document ).bind( "pagecreate create", function( e ){
+ $( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='controlgroup')", e.target )
.jqmEnhanceable()
.controlgroup({ excludeInvisible: false });
});
}
//dom-ready inits
- if( $.mobile.autoInitializePage ){
+ if ( $.mobile.autoInitializePage ) {
$.mobile.initializePage();
}
@@ -8,7 +8,7 @@ define( [ "jquery" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
//links within content areas, tests included with page
$( e.target )
@@ -32,7 +32,7 @@ $.mobile.media = (function() {
//must set type for IE!
styleBlock.type = "text/css";
- if ( styleBlock.styleSheet ){
+ if ( styleBlock.styleSheet ) {
styleBlock.styleSheet.cssText = cssrule;
} else {
styleBlock.appendChild( document.createTextNode(cssrule) );
Oops, something went wrong.

0 comments on commit 4b95883

Please sign in to comment.