Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

lint fixes for js/*

  • Loading branch information...
commit 5f96df7d658570ffdc8508c7668bd499304cd32d 1 parent bf1c8e0
John Bender johnbender authored
31 js/jquery.mobile.forms.select.custom.js
@@ -3,7 +3,7 @@
3 3 */
4 4
5 5 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
6   -//>>description: Extension to select menus to support menu styling, placeholder options, and multi-select features.
  6 +//>>description: Extension to select menus to support menu styling, placeholder options, and multi-select features.
7 7 //>>label: Selects: Custom menus
8 8 //>>group: Forms
9 9 //>>css: ../css/themes/default/jquery.mobile.theme.css, ../css/structure/jquery.mobile.forms.select.css
@@ -101,9 +101,9 @@ define( [
101 101
102 102 // Button events
103 103 self.button.bind( "vclick keydown" , function( event ) {
104   - if ( event.type == "vclick" ||
105   - event.keyCode && ( event.keyCode === $.mobile.keyCode.ENTER ||
106   - event.keyCode === $.mobile.keyCode.SPACE ) ) {
  104 + if (event.type === "vclick" ||
  105 + event.keyCode && (event.keyCode === $.mobile.keyCode.ENTER ||
  106 + event.keyCode === $.mobile.keyCode.SPACE)) {
107 107
108 108 self.open();
109 109 event.preventDefault();
@@ -160,7 +160,7 @@ define( [
160 160 // switch logic based on which key was pressed
161 161 switch ( event.keyCode ) {
162 162 // up or left arrow keys
163   - case 38:
  163 + case 38:
164 164 prev = li.prev().not( ".ui-selectmenu-placeholder" );
165 165
166 166 if( prev.is( ".ui-li-divider" ) ) {
@@ -177,10 +177,8 @@ define( [
177 177 }
178 178
179 179 return false;
180   - break;
181   -
182 180 // down or right arrow keys
183   - case 40:
  181 + case 40:
184 182 next = li.next();
185 183
186 184 if( next.is( ".ui-li-divider" ) ) {
@@ -197,15 +195,12 @@ define( [
197 195 }
198 196
199 197 return false;
200   - break;
201   -
202 198 // If enter or space is pressed, trigger click
203   - case 13:
204   - case 32:
  199 + case 13:
  200 + case 32:
205 201 target.trigger( "click" );
206 202
207 203 return false;
208   - break;
209 204 }
210 205 });
211 206
@@ -238,7 +233,7 @@ define( [
238 233 // Close button on small overlays
239 234 if( self.isMultiple ){
240 235 self.headerClose.click( function() {
241   - if ( self.menuType == "overlay" ) {
  236 + if ( self.menuType === "overlay" ) {
242 237 self.close();
243 238 return false;
244 239 }
@@ -308,7 +303,7 @@ define( [
308 303
309 304 var self = this;
310 305
311   - if ( self.menuType == "page" ) {
  306 + if ( self.menuType === "page" ) {
312 307 // doesn't solve the possible issue with calling change page
313 308 // where the objects don't define data urls which prevents dialog key
314 309 // stripping - changePage has incoming refactor
@@ -365,7 +360,7 @@ define( [
365 360 self.thisPage.unbind( "pagehide.remove" );
366 361
367 362 //for WebOS/Opera Mini (set lastscroll using button offset)
368   - if ( scrollTop == 0 && btnOffset > screenHeight ) {
  363 + if ( scrollTop === 0 && btnOffset > screenHeight ) {
369 364 self.thisPage.one( "pagehide", function() {
370 365 $( this ).jqmData( "lastScroll", btnOffset );
371 366 });
@@ -468,7 +463,7 @@ define( [
468 463 // Are we inside an optgroup?
469 464 if (parent !== select && parent.nodeName.toLowerCase() === "optgroup"){
470 465 var optLabel = parent.getAttribute('label');
471   - if ( optLabel != optGroup) {
  466 + if ( optLabel !== optGroup) {
472 467 var divider = document.createElement('li');
473 468 divider.setAttribute(dataRoleAttr,'list-divider');
474 469 divider.setAttribute('role','option');
@@ -479,7 +474,7 @@ define( [
479 474 }
480 475 }
481 476
482   - if (needPlaceholder && (!option.getAttribute( "value" ) || text.length == 0 || $option.jqmData( "placeholder" ))) {
  477 + if (needPlaceholder && (!option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ))) {
483 478 needPlaceholder = false;
484 479 if ( o.hidePlaceholderMenuItems ) {
485 480 classes.push( "ui-selectmenu-placeholder" );
6 js/jquery.mobile.listview.js
@@ -197,7 +197,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
197 197 theme: itemTheme
198 198 });
199 199
200   - if ( ( icon != false ) && ( a.length == 1 ) ) {
  200 + if ( ( icon !== false ) && ( a.length === 1 ) ) {
201 201 item.addClass( "ui-li-has-arrow" );
202 202 }
203 203
@@ -342,8 +342,8 @@ $.widget( "mobile.listview", $.mobile.widget, {
342 342 list = $( this ),
343 343 listId = list.attr( "id" ) || parentListId + "-" + i,
344 344 parent = list.parent(),
345   - nodeEls = $( list.prevAll().toArray().reverse() ),
346   - nodeEls = nodeEls.length ? nodeEls : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ),
  345 + nodeElsFull = $( list.prevAll().toArray().reverse() ),
  346 + nodeEls = nodeElsFull.length ? nodeElsFull : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ),
347 347 title = nodeEls.first().getEncodedText(),//url limits to first 30 chars of text
348 348 id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId,
349 349 theme = list.jqmData( "theme" ) || o.theme,
20 js/jquery.mobile.loader.js
@@ -58,9 +58,9 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.init" ], function(
58 58 },
59 59
60 60 defaultHtml: "<div class='" + loaderClass + "'>" +
61   - "<span class='ui-icon ui-icon-loading'></span>" +
62   - "<h1></h1>" +
63   - "</div>",
  61 + "<span class='ui-icon ui-icon-loading'></span>" +
  62 + "<h1></h1>" +
  63 + "</div>",
64 64
65 65 // For non-fixed supportin browsers. Position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
66 66 fakeFixLoader: function(){
@@ -103,7 +103,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.init" ], function(
103 103 var loadSettings;
104 104
105 105 // support for object literal params
106   - if( $.type(theme) == "object" ){
  106 + if( $.type(theme) === "object" ){
107 107 loadSettings = $.extend({}, this.options, theme);
108 108
109 109 // prefer object property from the param then the old theme setting
@@ -115,22 +115,22 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.init" ], function(
115 115
116 116 $html.addClass( "ui-loading" );
117 117
118   - if ( $.mobile.loadingMessage != false || loadSettings.html ) {
  118 + if ( $.mobile.loadingMessage !== false || loadSettings.html ) {
119 119 // text visibility from argument takes priority
120 120 var textVisible, message, $header;
121 121
122 122 // boolean values require a bit more work :P
123 123 // support object properties and old settings
124   - if( $.mobile.loadingMessageTextVisible != undefined ) {
  124 + if( $.mobile.loadingMessageTextVisible !== undefined ) {
125 125 textVisible = $.mobile.loadingMessageTextVisible;
126 126 } else {
127 127 textVisible = loadSettings.textVisible;
128 128 }
129 129
130   - this.element.attr( "class", loaderClass +
131   - " ui-corner-all ui-body-" + theme +
132   - " ui-loader-" + ( textVisible ? "verbose" : "default" )
133   - + ( loadSettings.textonly || textonly ? " ui-loader-textonly" : "" ) );
  130 + this.element.attr("class", loaderClass +
  131 + " ui-corner-all ui-body-" + theme +
  132 + " ui-loader-" + ( textVisible ? "verbose" : "default" ) +
  133 + ( loadSettings.textonly || textonly ? " ui-loader-textonly" : "" ) );
134 134
135 135 // TODO verify that jquery.fn.html is ok to use in both cases here
136 136 // this might be overly defensive in preventing unknowing xss
52 js/jquery.mobile.transition.js
@@ -10,12 +10,12 @@ define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {
10 10 (function( $, window, undefined ) {
11 11
12 12 var createHandler = function( sequential ){
13   -
  13 +
14 14 // Default to sequential
15 15 if( sequential === undefined ){
16 16 sequential = true;
17 17 }
18   -
  18 +
19 19 return function( name, reverse, $to, $from ) {
20 20
21 21 var deferred = new $.Deferred(),
@@ -33,9 +33,9 @@ var createHandler = function( sequential ){
33 33 // By using scrollTo instead of silentScroll, we can keep things better in order
34 34 // Just to be precautios, disable scrollstart listening like silentScroll would
35 35 $.event.special.scrollstart.enabled = false;
36   -
  36 +
37 37 window.scrollTo( 0, toScroll );
38   -
  38 +
39 39 // reenable scrollstart listening like silentScroll would
40 40 setTimeout(function() {
41 41 $.event.special.scrollstart.enabled = true;
@@ -52,66 +52,66 @@ var createHandler = function( sequential ){
52 52 doneOut();
53 53 }
54 54 else {
55   - $from.animationComplete( doneOut );
  55 + $from.animationComplete( doneOut );
56 56 }
57   -
  57 +
58 58 // Set the from page's height and start it transitioning out
59 59 // Note: setting an explicit height helps eliminate tiling in the transitions
60 60 $from
61 61 .height( screenHeight + $(window ).scrollTop() )
62 62 .addClass( name + " out" + reverseClass );
63 63 },
64   -
  64 +
65 65 doneOut = function() {
66 66
67 67 if ( $from && sequential ) {
68 68 cleanFrom();
69 69 }
70   -
  70 +
71 71 startIn();
72 72 },
73   -
74   - startIn = function(){
75   -
76   - $to.addClass( $.mobile.activePageClass + toPreClass );
77   -
  73 +
  74 + startIn = function(){
  75 +
  76 + $to.addClass( $.mobile.activePageClass + toPreClass );
  77 +
78 78 // Send focus to page as it is now display: block
79 79 $.mobile.focusPage( $to );
80 80
81 81 // Set to page height
82 82 $to.height( screenHeight + toScroll );
83   -
  83 +
84 84 scrollPage();
85   -
  85 +
86 86 if( !none ){
87 87 $to.animationComplete( doneIn );
88 88 }
89   -
  89 +
90 90 $to
91 91 .removeClass( toPreClass )
92 92 .addClass( name + " in" + reverseClass );
93   -
  93 +
94 94 if( none ){
95 95 doneIn();
96 96 }
97   -
  97 +
98 98 },
99   -
  99 +
100 100 doneIn = function() {
101   -
  101 +
102 102 if ( !sequential ) {
103   -
  103 +
104 104 if( $from ){
105 105 cleanFrom();
106 106 }
107 107 }
108   -
  108 +
109 109 $to
110 110 .removeClass( "out in reverse " + name )
111 111 .height( "" );
112   -
  112 +
113 113 toggleViewportClass();
114   -
  114 +
115 115 // In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition
116 116 // This ensures we jump to that spot after the fact, if we aren't there already.
117 117 if( $( window ).scrollTop() !== toScroll ){
@@ -122,7 +122,7 @@ var createHandler = function( sequential ){
122 122 };
123 123
124 124 toggleViewportClass();
125   -
  125 +
126 126 if ( $from && !none ) {
127 127 startOut();
128 128 }
@@ -132,7 +132,7 @@ var createHandler = function( sequential ){
132 132
133 133 return deferred.promise();
134 134 };
135   -}
  135 +};
136 136
137 137 // generate the handlers from the above
138 138 var sequentialHandler = createHandler(),

0 comments on commit 5f96df7

Please sign in to comment.
Something went wrong with that request. Please try again.