diff --git a/js/widgets/forms/button.js b/js/widgets/forms/button.js index e8503c14f86..78f43a06271 100644 --- a/js/widgets/forms/button.js +++ b/js/widgets/forms/button.js @@ -31,8 +31,8 @@ $.widget( "mobile.button", $.mobile.widget, { $buttonPlaceholder; // if this is a link, check if it's been enhanced and, if not, use the right function - if( $el[ 0 ].tagName === "A" ) { - if( !$el.hasClass( "ui-btn" ) ) { + if ( $el[ 0 ].tagName === "A" ) { + if ( !$el.hasClass( "ui-btn" ) ) { $el.buttonMarkup(); } @@ -46,18 +46,18 @@ $.widget( "mobile.button", $.mobile.widget, { } // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577 - /* if( $el[0].className.length ) { + /* if ( $el[0].className.length ) { classes = $el[0].className; } */ - if( !!~$el[0].className.indexOf( "ui-btn-left" ) ) { + if ( !!~$el[0].className.indexOf( "ui-btn-left" ) ) { classes = "ui-btn-left"; } - if( !!~$el[0].className.indexOf( "ui-btn-right" ) ) { + if ( !!~$el[0].className.indexOf( "ui-btn-right" ) ) { classes = "ui-btn-right"; } - if( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) { + if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) { classes ? classes += " ui-submit" : classes = "ui-submit"; } $( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" ); @@ -87,7 +87,7 @@ $.widget( "mobile.button", $.mobile.widget, { if ( type !== "button" && type !== "reset" && name ) { $el.bind( "vclick", function() { // Add hidden input if it doesn't already exist. - if( $buttonPlaceholder === undefined ) { + if ( $buttonPlaceholder === undefined ) { $buttonPlaceholder = $( "", { type: "hidden", name: $el.attr( "name" ), @@ -95,7 +95,7 @@ $.widget( "mobile.button", $.mobile.widget, { }).insertBefore( $el ); // Bind to doc to remove after submit handling - $( document ).one("submit", function(){ + $( document ).one( "submit", function() { $buttonPlaceholder.remove(); // reset the local var so that the hidden input @@ -146,7 +146,7 @@ $.widget( "mobile.button", $.mobile.widget, { }); //auto self-init widgets -$( document ).bind( "pagecreate create", function( e ){ +$( document ).bind( "pagecreate create", function( e ) { $.mobile.button.prototype.enhanceWithin( e.target, true ); }); diff --git a/js/widgets/forms/checkboxradio.js b/js/widgets/forms/checkboxradio.js index d57f409b4a8..a59ac6ae611 100644 --- a/js/widgets/forms/checkboxradio.js +++ b/js/widgets/forms/checkboxradio.js @@ -27,7 +27,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { // NOTE: Windows Phone could not find the label through a selector // filter works though. parentLabel = $( input ).closest( "label" ), - label = parentLabel.length ? parentLabel : $( input ).closest( "form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ), + label = parentLabel.length ? parentLabel : $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ), inputtype = input[0].type, mini = inheritAttr( input, "mini" ), checkedState = inputtype + "-on", @@ -55,7 +55,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { }); // If there's no selected theme check the data attr - if( !this.options.theme ) { + if ( !this.options.theme ) { this.options.theme = $.mobile.getInheritedTheme( this.element, "c" ); } @@ -114,13 +114,13 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { }, vclick: function() { - var $this = $(this); + var $this = $( this ); // Adds checked attribute to checked input when keyboard is used if ( $this.is( ":checked" ) ) { $this.prop( "checked", true); - self._getInputSet().not($this).prop( "checked", false ); + self._getInputSet().not( $this ).prop( "checked", false ); } else { $this.prop( "checked", false ); @@ -143,25 +143,25 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { _cacheVals: function() { this._getInputSet().each(function() { - $(this).jqmData( "cacheVal", this.checked ); + $( this ).jqmData( "cacheVal", this.checked ); }); }, //returns either a set of radios with the same name attribute, or a single checkbox - _getInputSet: function(){ - if(this.inputtype === "checkbox") { + _getInputSet: function() { + if ( this.inputtype === "checkbox" ) { return this.element; } - return this.element.closest( "form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')" ) - .find( "input[name='"+ this.element[0].name +"'][type='"+ this.inputtype +"']" ); + return this.element.closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ) + .find( "input[name='" + this.element[0].name + "'][type='" + this.inputtype + "']" ); }, _updateAll: function() { var self = this; this._getInputSet().each(function() { - var $this = $(this); + var $this = $( this ); if ( this.checked || self.inputtype === "checkbox" ) { $this.trigger( "change" ); @@ -200,7 +200,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { }); //auto self-init widgets -$( document ).bind( "pagecreate create", function( e ){ +$( document ).bind( "pagecreate create", function( e ) { $.mobile.checkboxradio.prototype.enhanceWithin( e.target, true ); }); diff --git a/js/widgets/forms/select.custom.js b/js/widgets/forms/select.custom.js index 63ab87e8dca..95c9e2dd39f 100644 --- a/js/widgets/forms/select.custom.js +++ b/js/widgets/forms/select.custom.js @@ -22,7 +22,7 @@ define( [ "../page.sections" ], function( $ ) { //>>excludeEnd("jqmBuildExclude"); (function( $, undefined ) { - var extendSelect = function( widget ){ + var extendSelect = function( widget ) { var select = widget.select, selectID = widget.selectID, @@ -60,7 +60,7 @@ define( [ menuPageClose, headerClose; - if( widget.isMultiple ) { + if ( widget.isMultiple ) { headerClose = $( "", { "text": widget.options.closeText, "href": "#", @@ -112,13 +112,13 @@ define( [ // Events for list items self.list.attr( "role", "listbox" ) - .bind( "focusin", function( e ){ + .bind( "focusin", function( e ) { $( e.target ) .attr( "tabindex", "0" ) .trigger( "vmouseover" ); }) - .bind( "focusout", function( e ){ + .bind( "focusout", function( e ) { $( e.target ) .attr( "tabindex", "-1" ) .trigger( "vmouseout" ); @@ -168,7 +168,7 @@ define( [ case 38: prev = li.prev().not( ".ui-selectmenu-placeholder" ); - if( prev.is( ".ui-li-divider" ) ) { + if ( prev.is( ".ui-li-divider" ) ) { prev = prev.prev(); } @@ -186,7 +186,7 @@ define( [ case 40: next = li.next(); - if( next.is( ".ui-li-divider" ) ) { + if ( next.is( ".ui-li-divider" ) ) { next = next.next(); } @@ -236,8 +236,8 @@ define( [ }); // Close button on small overlays - if( self.isMultiple ){ - self.headerClose.click( function() { + if ( self.isMultiple ) { + self.headerClose.click(function() { if ( self.menuType === "overlay" ) { self.close(); return false; @@ -261,10 +261,10 @@ define( [ }, selected: function() { - return this._selectOptions().filter( ":selected:not(:jqmData(placeholder='true'))" ); + return this._selectOptions().filter( ":selected:not( :jqmData(placeholder='true') )" ); }, - refresh: function( forceRebuild , foo ){ + refresh: function( forceRebuild , foo ) { var self = this, select = this.element, isMultiple = this.isMultiple, @@ -294,7 +294,7 @@ define( [ if ( self.isMultiple ) { item.find( ".ui-icon" ).removeClass( "ui-icon-checkbox-off" ).addClass( "ui-icon-checkbox-on" ); } else { - if( item.is( ".ui-selectmenu-placeholder" ) ) { + if ( item.is( ".ui-selectmenu-placeholder" ) ) { item.next().addClass( $.mobile.activeBtnClass ); } else { item.addClass( $.mobile.activeBtnClass ); @@ -353,7 +353,7 @@ define( [ function focusMenuItem() { var selector = self.list.find( "." + $.mobile.activeBtnClass + " a" ); if ( selector.length === 0 ) { - selector = self.list.find( "li.ui-btn:not(:jqmData(placeholder='true')) a" ); + selector = self.list.find( "li.ui-btn:not( :jqmData(placeholder='true') ) a" ); } selector.first().focus().closest( "li" ).addClass( "ui-btn-down-" + widget.options.theme ); } @@ -412,7 +412,7 @@ define( [ self.list.empty().filter( ".ui-listview" ).listview( "destroy" ); - var $options = self.select.find("option"), + var $options = self.select.find( "option" ), numOptions = $options.length, select = this.select[ 0 ], dataPrefix = 'data-' + $.mobile.ns, @@ -424,32 +424,32 @@ define( [ isPlaceholderItem = false, optGroup; - for (var i = 0; i < numOptions;i++, isPlaceholderItem = false){ + for (var i = 0; i < numOptions;i++, isPlaceholderItem = false) { var option = $options[i], - $option = $(option), + $option = $( option ), parent = option.parentNode, text = $option.text(), - anchor = document.createElement('a'), + anchor = document.createElement( 'a' ), classes = []; - anchor.setAttribute('href','#'); - anchor.appendChild(document.createTextNode(text)); + anchor.setAttribute( 'href', '#' ); + anchor.appendChild( document.createTextNode( text ) ); // Are we inside an optgroup? - if (parent !== select && parent.nodeName.toLowerCase() === "optgroup"){ - var optLabel = parent.getAttribute('label'); - if ( optLabel !== optGroup) { - var divider = document.createElement('li'); - divider.setAttribute(dataRoleAttr,'list-divider'); - divider.setAttribute('role','option'); - divider.setAttribute('tabindex','-1'); - divider.appendChild(document.createTextNode(optLabel)); - fragment.appendChild(divider); + if ( parent !== select && parent.nodeName.toLowerCase() === "optgroup" ) { + var optLabel = parent.getAttribute( 'label' ); + if ( optLabel !== optGroup ) { + var divider = document.createElement( 'li' ); + divider.setAttribute( dataRoleAttr, 'list-divider' ); + divider.setAttribute( 'role', 'option' ); + divider.setAttribute( 'tabindex', '-1' ); + divider.appendChild( document.createTextNode( optLabel ) ); + fragment.appendChild( divider ); optGroup = optLabel; } } - if (needPlaceholder && (!option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ))) { + if ( needPlaceholder && ( !option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ) ) ) { needPlaceholder = false; isPlaceholderItem = true; @@ -468,19 +468,19 @@ define( [ classes.push( "ui-disabled" ); item.setAttribute('aria-disabled',true); } - item.setAttribute(dataIndexAttr,i); - item.setAttribute(dataIconAttr,dataIcon); + item.setAttribute( dataIndexAttr,i ); + item.setAttribute( dataIconAttr, dataIcon ); if ( isPlaceholderItem ) { item.setAttribute( dataPlaceholderAttr, true ); } - item.className = classes.join(" "); - item.setAttribute('role','option'); - anchor.setAttribute('tabindex','-1'); - item.appendChild(anchor); - fragment.appendChild(item); + item.className = classes.join( " " ); + item.setAttribute( 'role', 'option' ); + anchor.setAttribute( 'tabindex', '-1' ); + item.appendChild( anchor ); + fragment.appendChild( item ); } - self.list[0].appendChild(fragment); + self.list[0].appendChild( fragment ); // Hide header if it's not a multiselect and there's no placeholder if ( !this.isMultiple && !placeholder.length ) { @@ -493,7 +493,7 @@ define( [ self.list.listview(); }, - _button: function(){ + _button: function() { return $( "", { "href": "#", "role": "button", @@ -508,12 +508,12 @@ define( [ }); }; - // issue #3894 - core doesn't triggered events on disabled delegates - $( document ).bind( "selectmenubeforecreate", function( event ){ + // issue #3894 - core doesn't trigger events on disabled delegates + $( document ).bind( "selectmenubeforecreate", function( event ) { var selectmenuWidget = $( event.target ).data( "selectmenu" ); - if( !selectmenuWidget.options.nativeMenu && - selectmenuWidget.element.parents(":jqmData(role='popup')").length === 0 ){ + if ( !selectmenuWidget.options.nativeMenu && + selectmenuWidget.element.parents( ":jqmData(role='popup')" ).length === 0 ) { extendSelect( selectmenuWidget ); } }); diff --git a/js/widgets/forms/select.js b/js/widgets/forms/select.js index dd366211b2a..5cb3dd84773 100644 --- a/js/widgets/forms/select.js +++ b/js/widgets/forms/select.js @@ -25,11 +25,11 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { nativeMenu: true, // This option defaults to true on iOS devices. preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1, - initSelector: "select:not(:jqmData(role='slider'))", + initSelector: "select:not( :jqmData(role='slider') )", mini: false }, - _button: function(){ + _button: function() { return $( "
" ); }, @@ -52,17 +52,17 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { }, // setup items that are generally necessary for select menu extension - _preExtension: function(){ + _preExtension: function() { var classes = ""; // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577 - /* if( $el[0].className.length ) { + /* if ( $el[0].className.length ) { classes = $el[0].className; } */ - if( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) { + if ( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) { classes = " ui-btn-left"; } - if( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) { + if ( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) { classes = " ui-btn-right"; } @@ -136,7 +136,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { } // Events on native select - this.select.change( function() { + this.select.change(function() { self.refresh(); }); @@ -175,11 +175,11 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { // In many situations, iOS will zoom into the select upon tap, this prevents that from happening self.button.bind( "vmousedown", function() { - if( self.options.preventFocusZoom ){ + if ( self.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }).bind( "mouseup", function() { - if( self.options.preventFocusZoom ){ + if ( self.options.preventFocusZoom ) { $.mobile.zoom.enable( true ); } }); @@ -192,7 +192,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { selectedIndices: function() { var self = this; - return this.selected().map( function() { + return this.selected().map(function() { return self._selectOptions().index( this ); }).get(); }, @@ -201,7 +201,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { var self = this, selected = this.selected(), text = this.placeholder, - span = $( document.createElement("span") ); + span = $( document.createElement( "span" ) ); this.button.find( ".ui-btn-text" ).html(function() { if ( selected.length ) { @@ -214,8 +214,8 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { // TODO possibly aggregate multiple select option classes return span.text( text ) - .addClass( self.select.attr("class") ) - .addClass( selected.attr("class") ); + .addClass( self.select.attr( "class" ) ) + .addClass( selected.attr( "class" ) ); }); }, @@ -250,7 +250,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { }); //auto self-init widgets -$( document ).bind( "pagecreate create", function( e ){ +$( document ).bind( "pagecreate create", function( e ) { $.mobile.selectmenu.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); diff --git a/js/widgets/forms/slider.js b/js/widgets/forms/slider.js index f3621248783..0a7863389ea 100644 --- a/js/widgets/forms/slider.js +++ b/js/widgets/forms/slider.js @@ -7,7 +7,7 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "./textinput", "../../jquery.mobile.buttonMarkup" ], function( $ ) { //>>excludeEnd("jqmBuildExclude"); -( function( $, undefined ) { +(function( $, undefined ) { $.widget( "mobile.slider", $.mobile.widget, { options: { @@ -53,17 +53,17 @@ $.widget( "mobile.slider", $.mobile.widget, { step = window.parseFloat( control.attr( "step" ) || 1 ), - inlineClass = ( this.options.inline || control.jqmData("inline") === true ) ? " ui-slider-inline" : "", + inlineClass = ( this.options.inline || control.jqmData( "inline" ) === true ) ? " ui-slider-inline" : "", - miniClass = ( this.options.mini || control.jqmData("mini") ) ? " ui-slider-mini" : "", + miniClass = ( this.options.mini || control.jqmData( "mini" ) ) ? " ui-slider-mini" : "", - domHandle = document.createElement('a'), + domHandle = document.createElement( 'a' ), handle = $( domHandle ), - domSlider = document.createElement('div'), + domSlider = document.createElement( 'div' ), slider = $( domSlider ), - valuebg = control.jqmData("highlight") && cType !== "select" ? (function() { + valuebg = control.jqmData( "highlight" ) && cType !== "select" ? (function() { var bg = document.createElement('div'); bg.className = 'ui-slider-bg ' + $.mobile.activeBtnClass + ' ui-btn-corner-all'; return $( bg ).prependTo( slider ); @@ -73,9 +73,9 @@ $.widget( "mobile.slider", $.mobile.widget, { domHandle.setAttribute( 'href', "#" ); domSlider.setAttribute('role','application'); - domSlider.className = ['ui-slider ',selectClass," ui-btn-down-",trackTheme,' ui-btn-corner-all', inlineClass, miniClass].join(""); + domSlider.className = ['ui-slider ',selectClass," ui-btn-down-",trackTheme,' ui-btn-corner-all', inlineClass, miniClass].join( "" ); domHandle.className = 'ui-slider-handle'; - domSlider.appendChild(domHandle); + domSlider.appendChild( domHandle ); handle.buttonMarkup({ corners: true, theme: theme, shadow: true }) .attr({ @@ -102,11 +102,11 @@ $.widget( "mobile.slider", $.mobile.widget, { var wrapper = document.createElement('div'); wrapper.className = 'ui-slider-inneroffset'; - for(var j = 0,length = domSlider.childNodes.length;j < length;j++){ - wrapper.appendChild(domSlider.childNodes[j]); + for ( var j = 0,length = domSlider.childNodes.length;j < length;j++ ) { + wrapper.appendChild( domSlider.childNodes[j] ); } - domSlider.appendChild(wrapper); + domSlider.appendChild( wrapper ); // slider.wrapInner( "
" ); @@ -115,15 +115,15 @@ $.widget( "mobile.slider", $.mobile.widget, { options = control.find( "option" ); - for(var i = 0, optionsCount = options.length; i < optionsCount; i++){ - var side = !i ? "b":"a", - sliderTheme = !i ? " ui-btn-down-" + trackTheme :( " " + $.mobile.activeBtnClass ), - sliderLabel = document.createElement('div'), - sliderImg = document.createElement('span'); + for ( var i = 0, optionsCount = options.length; i < optionsCount; i++ ) { + var side = !i ? "b" : "a", + sliderTheme = !i ? " ui-btn-down-" + trackTheme : ( " " + $.mobile.activeBtnClass ), + sliderLabel = document.createElement( 'div' ), + sliderImg = document.createElement( 'span' ); - sliderImg.className = ['ui-slider-label ui-slider-label-',side,sliderTheme," ui-btn-corner-all"].join(""); + sliderImg.className = ['ui-slider-label ui-slider-label-',side,sliderTheme," ui-btn-corner-all"].join( "" ); sliderImg.setAttribute('role','img'); - sliderImg.appendChild(document.createTextNode(options[i].innerHTML)); + sliderImg.appendChild( document.createTextNode( options[i].innerHTML ) ); $(sliderImg).prependTo( slider ); } @@ -135,16 +135,16 @@ $.widget( "mobile.slider", $.mobile.widget, { // monitor the input for updated values control.addClass( cType === "input" ? "ui-slider-input" : "ui-slider-switch" ) - .change( function() { + .change(function() { // if the user dragged the handle, the "change" event was triggered from inside refresh(); don't call refresh() again - if (!self.mouseMoved) { + if ( !self.mouseMoved ) { self.refresh( val(), true ); } }) - .keyup( function() { // necessary? + .keyup(function() { // necessary? self.refresh( val(), true, true ); }) - .blur( function() { + .blur(function() { self.refresh( val(), true ); }); @@ -219,7 +219,7 @@ $.widget( "mobile.slider", $.mobile.widget, { slider.insertAfter( control ); // Only add focus class to toggle switch, sliders get it automatically from ui-btn - if( cType === 'select' ) { + if ( cType === 'select' ) { this.handle.bind({ focus: function() { slider.addClass( $.mobile.focusClass ); @@ -294,7 +294,7 @@ $.widget( "mobile.slider", $.mobile.widget, { } }); - this.refresh(undefined, undefined, true); + this.refresh( undefined, undefined, true ); }, refresh: function( val, isfromControl, preventInputUpdate ) { @@ -307,7 +307,7 @@ $.widget( "mobile.slider", $.mobile.widget, { cType = control[0].nodeName.toLowerCase(), min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0, max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length - 1, - step = (cType === "input" && parseFloat( control.attr( "step" ) ) > 0) ? parseFloat(control.attr("step")) : 1; + step = ( cType === "input" && parseFloat( control.attr( "step" ) ) > 0 ) ? parseFloat( control.attr( "step" ) ) : 1; if ( typeof val === "object" ) { var data = val, @@ -366,7 +366,7 @@ $.widget( "mobile.slider", $.mobile.widget, { title: cType === "input" ? newval : control.find( "option" ).eq( newval ).getEncodedText() }); - if( this.valuebg ){ + if ( this.valuebg ) { this.valuebg.css( "width", percent + "%" ); } @@ -376,8 +376,8 @@ $.widget( "mobile.slider", $.mobile.widget, { aPercent = percent && handlePercent + ( 100 - handlePercent ) * percent / 100, bPercent = percent === 100 ? 0 : Math.min( handlePercent + 100 - aPercent, 100 ); - this._labels.each(function(){ - var ab = $(this).is( ".ui-slider-label-a" ); + this._labels.each(function() { + var ab = $( this ).is( ".ui-slider-label-a" ); $( this ).width( ( ab ? aPercent : bPercent ) + "%" ); }); } @@ -414,7 +414,7 @@ $.widget( "mobile.slider", $.mobile.widget, { }); //auto self-init widgets -$( document ).bind( "pagecreate create", function( e ){ +$( document ).bind( "pagecreate create", function( e ) { $.mobile.slider.prototype.enhanceWithin( e.target, true ); }); diff --git a/js/widgets/forms/textinput.js b/js/widgets/forms/textinput.js index f516eb6631c..96529b7f89f 100644 --- a/js/widgets/forms/textinput.js +++ b/js/widgets/forms/textinput.js @@ -25,14 +25,14 @@ $.widget( "mobile.textinput", $.mobile.widget, { o = this.options, theme = o.theme || $.mobile.getInheritedTheme( this.element, "c" ), themeclass = " ui-body-" + theme, - mini = input.jqmData("mini") === true, + mini = input.jqmData( "mini" ) === true, miniclass = mini ? " ui-mini" : "", focusedEl, clearbtn; function toggleClear() { - setTimeout(function() { + setTimeout( function() { clearbtn.toggleClass( "ui-input-clear-hidden", !input.val() ); - }, 0); + }, 0 ); } $( "label[for='" + input.attr( "id" ) + "']" ).addClass( "ui-input-text" ); @@ -78,7 +78,7 @@ $.widget( "mobile.textinput", $.mobile.widget, { toggleClear(); - input.bind('paste cut keyup focus change blur', toggleClear); + input.bind( 'paste cut keyup focus change blur', toggleClear ); } else { input.addClass( "ui-corner-all ui-shadow-inset" + themeclass + miniclass ); @@ -87,17 +87,17 @@ $.widget( "mobile.textinput", $.mobile.widget, { input.focus(function() { focusedEl.addClass( $.mobile.focusClass ); }) - .blur(function(){ + .blur(function() { focusedEl.removeClass( $.mobile.focusClass ); }) // In many situations, iOS will zoom into the select upon tap, this prevents that from happening .bind( "focus", function() { - if( o.preventFocusZoom ){ + if ( o.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }) .bind( "blur", function() { - if( o.preventFocusZoom ){ + if ( o.preventFocusZoom ) { $.mobile.zoom.enable( true ); } }); @@ -137,10 +137,10 @@ $.widget( "mobile.textinput", $.mobile.widget, { } }, - disable: function(){ + disable: function() { var $el; - if ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ) { + if ( this.element.attr( "disabled", true ).is( "[type='search'], :jqmData(type='search')" ) ) { $el = this.element.parent(); } else { $el = this.element; @@ -150,10 +150,10 @@ $.widget( "mobile.textinput", $.mobile.widget, { }, - enable: function(){ + enable: function() { var $el; - if ( this.element.attr( "disabled", false ).is( "[type='search'],:jqmData(type='search')" ) ) { + if ( this.element.attr( "disabled", false ).is( "[type='search'], :jqmData(type='search')" ) ) { $el = this.element.parent(); } else { $el = this.element; @@ -165,7 +165,7 @@ $.widget( "mobile.textinput", $.mobile.widget, { }); //auto self-init widgets -$( document ).bind( "pagecreate create", function( e ){ +$( document ).bind( "pagecreate create", function( e ) { $.mobile.textinput.prototype.enhanceWithin( e.target, true ); });