Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

exposed automatic initialization selectors on most widgets that expos…

…e options through the widget factory. Option name is "initSelector"
  • Loading branch information...
commit e07c40e3d0bbc2826133dc8dd3552e030687cd9a 1 parent 79d3aa6
scottjehl authored
View
7 js/jquery.mobile.collapsible.js
@@ -7,8 +7,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(role='collapsible')";
+
$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='collapsible')", e.target ).collapsible();
+ $( initSelector, e.target ).collapsible();
});
$.widget( "mobile.collapsible", $.mobile.widget, {
@@ -18,7 +20,8 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsed: false,
heading: ">:header,>legend",
theme: null,
- iconTheme: "d"
+ iconTheme: "d",
+ initSelector: initSelector
},
_create: function() {
View
4 js/jquery.mobile.controlGroup.js
@@ -7,8 +7,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(role='controlgroup')";
+
$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='controlgroup')", e.target ).controlgroup({ excludeInvisible: false });
+ $( initSelector, e.target ).controlgroup({ excludeInvisible: false });
});
$.fn.controlgroup = function( options ) {
View
7 js/jquery.mobile.dialog.js
@@ -7,14 +7,17 @@
(function( $, window, undefined ) {
//auto self-init widgets
-$( ":jqmData(role='dialog')" ).live( "pagecreate", function(){
+var initSelector = ":jqmData(role='dialog')";
+
+$( initSelector ).live( "pagecreate", function(){
$( this ).dialog();
});
$.widget( "mobile.dialog", $.mobile.widget, {
options: {
closeBtnText : "Close",
- theme : "a"
+ theme : "a",
+ initSelector : initSelector
},
_create: function() {
var $el = this.element,
View
4 js/jquery.mobile.fieldContain.js
@@ -8,8 +8,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(role='fieldcontain')";
+
$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='fieldcontain')", e.target ).fieldcontain();
+ $( initSelector, e.target ).fieldcontain();
});
$.fn.fieldcontain = function( options ) {
View
4 js/jquery.mobile.fixHeaderFooter.js
@@ -8,9 +8,11 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(position='fixed')";
+
$( document ).bind( "pagecreate create", function( e ){
- if( $( ":jqmData(position='fixed')", e.target ).length ){
+ if( $( initSelector, e.target ).length ){
$( e.target ).each(function(){
if ( !$.support.scrollTop ) {
View
7 js/jquery.mobile.forms.button.js
@@ -8,8 +8,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = "button, [type='button'], [type='submit'], [type='reset'], [type='image']";
+
$( document ).bind( "pagecreate create", function( e ){
- $( "button, [type='button'], [type='submit'], [type='reset'], [type='image']", e.target )
+ $( initSelector, e.target )
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.button();
});
@@ -22,7 +24,8 @@ $.widget( "mobile.button", $.mobile.widget, {
inline: null,
corners: true,
shadow: true,
- iconshadow: true
+ iconshadow: true,
+ initSelector: initSelector
},
_create: function() {
var $el = this.element,
View
7 js/jquery.mobile.forms.checkboxradio.js
@@ -8,15 +8,18 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = "input[type='checkbox'],input[type='radio']";
+
$( document ).bind( "pagecreate create", function( e ){
- $( "input[type='checkbox'],input[type='radio']", e.target )
+ $( $.mobile.checkboxradio.prototype.options.initSelector, e.target )
@negue
negue added a note

This is the only initSelector which is from .prototype.options.

All other are just using the default var initSelector, maybe all inits should use .prototype.options.initSelector

Thanks - yep that should be initSelector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.checkboxradio();
});
$.widget( "mobile.checkboxradio", $.mobile.widget, {
options: {
- theme: null
+ theme: null,
+ initSelector: initSelector
},
_create: function() {
var self = this,
View
7 js/jquery.mobile.forms.select.js
@@ -8,8 +8,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = "select:not(:jqmData(role='slider'))";
+
$( document ).bind( "pagecreate create", function( e ){
- $( "select:not(:jqmData(role='slider'))", e.target )
+ $( initSelector, e.target )
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.selectmenu();
});
@@ -28,7 +30,8 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
overlayTheme: "a",
hidePlaceholderMenuItems: true,
closeText: "Close",
- nativeMenu: true
+ nativeMenu: true,
+ initSelector: initSelector
},
_create: function() {
View
7 js/jquery.mobile.forms.slider.js
@@ -8,10 +8,12 @@
( function( $, undefined ) {
//auto self-init widgets
+var initSelector = "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')";
+
$( document ).bind( "pagecreate create", function( e ){
//now self-init
- $( "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')", e.target )
+ $( initSelector, e.target )
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.slider();
@@ -21,7 +23,8 @@ $.widget( "mobile.slider", $.mobile.widget, {
options: {
theme: null,
trackTheme: null,
- disabled: false
+ disabled: false,
+ initSelector: initSelector
},
_create: function() {
View
7 js/jquery.mobile.forms.textinput.js
@@ -8,15 +8,18 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea";
+
$( document ).bind( "pagecreate create", function( e ){
- $( "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea", e.target )
+ $( initSelector, e.target )
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
.textinput();
});
$.widget( "mobile.textinput", $.mobile.widget, {
options: {
- theme: null
+ theme: null,
+ initSelector: initSelector
},
_create: function() {
View
7 js/jquery.mobile.listview.js
@@ -8,8 +8,10 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(role='listview')";
+
$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='listview')", e.target ).listview();
+ $( initSelector, e.target ).listview();
});
//Keeps track of the number of lists per page UID
@@ -25,7 +27,8 @@ $.widget( "mobile.listview", $.mobile.widget, {
dividerTheme: "b",
splitIcon: "arrow-r",
splitTheme: "b",
- inset: false
+ inset: false,
+ initSelector: initSelector
},
_create: function() {
View
7 js/jquery.mobile.navbar.js
@@ -8,14 +8,17 @@
(function( $, undefined ) {
//auto self-init widgets
+var initSelector = ":jqmData(role='navbar')";
+
$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='navbar')", e.target ).navbar();
+ $( initSelector, e.target ).navbar();
});
$.widget( "mobile.navbar", $.mobile.widget, {
options: {
iconpos: "top",
- grid: null
+ grid: null,
+ initSelector: initSelector
},
_create: function(){
Please sign in to comment.
Something went wrong with that request. Please try again.