Tizen 2.0 Release
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / js / jquery.mobile.fieldContain.js
1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Styling to responsively position forms and labels based on screen width and add visual separation
3 //>>label: Fieldcontainers
4 //>>group: Forms
5 //>>css.structure: ../css/structure/jquery.mobile.forms.fieldcontain.css
6 //>>css.theme: ../css/themes/default/jquery.mobile.theme.css
7
8 define( [ "jquery" ], function( $ ) {
9 //>>excludeEnd("jqmBuildExclude");
10 (function( $, undefined ) {
11
12 // filter function removes whitespace between label and form element so we can use inline-block (nodeType 3 = text)
13 $.fn.fieldcontain = function( options ) {
14         return this
15                 .addClass( "ui-field-contain ui-body ui-br" )
16                 .contents().filter( function() {
17                         return ( this.nodeType === 3 && !/\S/.test( this.nodeValue ) );
18                 }).remove();
19 };
20
21 //auto self-init widgets
22 $( document ).bind( "pagecreate create", function( e ) {
23         $( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain();
24 });
25
26 })( jQuery );
27 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
28 });
29 //>>excludeEnd("jqmBuildExclude");