diff --git a/Makefile b/Makefile index 2f1ef776e28..b94c4593c96 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # The files to include when compiling the JS files -JSFILES = js/jquery.ui.widget.js \ +JSFILES = js/modernizr.custom.js \ + js/jquery.ui.widget.js \ js/jquery.mobile.widget.js \ js/jquery.mobile.media.js \ js/jquery.mobile.support.js \ diff --git a/css/structure/jquery.mobile.forms.textinput.css b/css/structure/jquery.mobile.forms.textinput.css index 028a34a363b..017b3532b43 100644 --- a/css/structure/jquery.mobile.forms.textinput.css +++ b/css/structure/jquery.mobile.forms.textinput.css @@ -8,6 +8,8 @@ textarea.ui-input-text { height: 50px; -webkit-transition: height 200ms linear; .ui-input-search .ui-input-clear { position: absolute; right: 0; top: 50%; margin-top: -13px; } .ui-input-search .ui-input-clear-hidden { display: none; } +div.ui-input-border-box-fix, input.ui-input-border-box-fix, textarea.ui-input-border-box-fix { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; width: 100%; } + /* orientation adjustments - incomplete!*/ @media all and (min-width: 450px){ .ui-field-contain label.ui-input-text { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0 } @@ -19,4 +21,5 @@ textarea.ui-input-text { height: 50px; -webkit-transition: height 200ms linear; .ui-hide-label textarea.ui-input-text, .ui-hide-label .ui-input-search { padding: .4em; width: 97%; } .ui-input-search input.ui-input-text { width: 98%; /*echos rule from above*/ } + .ui-field-contain div.ui-input-border-box-fix { width: 60%; } /*echoes rule from above*/ } \ No newline at end of file diff --git a/js/index.php b/js/index.php index f3376871a8a..68785eaba49 100644 --- a/js/index.php +++ b/js/index.php @@ -2,6 +2,7 @@ $type = 'text/javascript'; $files = array( '../LICENSE-INFO.txt', + 'modernizr.custom.js', 'jquery.ui.widget.js', 'jquery.mobile.widget.js', 'jquery.mobile.media.js', diff --git a/js/jquery.mobile.forms.textinput.js b/js/jquery.mobile.forms.textinput.js index e44229fbc9c..0d8f8736bac 100644 --- a/js/jquery.mobile.forms.textinput.js +++ b/js/jquery.mobile.forms.textinput.js @@ -16,11 +16,12 @@ $.widget( "mobile.textinput", $.mobile.widget, { o = this.options, theme = o.theme || $.mobile.getInheritedTheme( this.element, "c" ), themeclass = " ui-body-" + theme, + boxSizing = Modernizr.testAllProps('boxSizing'), focusedEl, clearbtn; $( "label[for='" + input.attr( "id" ) + "']" ).addClass( "ui-input-text" ); - focusedEl = input.addClass("ui-input-text ui-body-"+ theme ); + focusedEl = input.addClass("ui-input-text ui-body-" + theme + (boxSizing ? " ui-input-border-box-fix" : "")); // XXX: Temporary workaround for issue 785 (Apple bug 8910589). // Turn off autocorrect and autocomplete on non-iOS 5 devices @@ -41,6 +42,10 @@ $.widget( "mobile.textinput", $.mobile.widget, { if ( input.is( "[type='search'],:jqmData(type='search')" ) ) { focusedEl = input.wrap( "
" ).parent(); + if(boxSizing) { + focusedEl.addClass('ui-input-border-box-fix'); + console.log(focusedEl); + } clearbtn = $( "clear text" ) .tap(function( event ) { input.val( "" ).focus(); @@ -125,4 +130,4 @@ $( document ).bind( "pagecreate create", function( e ){ $.mobile.textinput.prototype.enhanceWithin( e.target ); }); -})( jQuery ); +})( jQuery ); \ No newline at end of file diff --git a/js/modernizr.custom.js b/js/modernizr.custom.js new file mode 100644 index 00000000000..5ea7f62f924 --- /dev/null +++ b/js/modernizr.custom.js @@ -0,0 +1,4 @@ +/* Modernizr 2.0.6 (Custom Build) | MIT & BSD + * Build: http://www.modernizr.com/download/#-testprop-testallprops-domprefixes + */ +;window.Modernizr=function(a,b,c){function z(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+m.join(c+" ")+c).split(" ");return y(d,b)}function y(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function x(a,b){return!!~(""+a).indexOf(b)}function w(a,b){return typeof a===b}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function u(a){j.cssText=a}var d="2.0.6",e={},f=b.documentElement,g=b.head||b.getElementsByTagName("head")[0],h="modernizr",i=b.createElement(h),j=i.style,k,l=Object.prototype.toString,m="Webkit Moz O ms Khtml".split(" "),n={},o={},p={},q=[],r,s={}.hasOwnProperty,t;!w(s,c)&&!w(s.call,c)?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],c)};for(var A in n)t(n,A)&&(r=A.toLowerCase(),e[r]=n[A](),q.push((e[r]?"":"no-")+r));u(""),i=k=null,e._version=d,e._domPrefixes=m,e.testProp=function(a){return y([a])},e.testAllProps=z;return e}(this,this.document); \ No newline at end of file