mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
bound widgets to the "enhance" event, in addition to the pagecreate event. The enhance event allows developers to enhance the contents of an html fragment by triggering "enhance".
This commit is contained in:
parent
2a6c7fc1b9
commit
64e6ef0e72
15 changed files with 20 additions and 14 deletions
|
|
@ -140,7 +140,7 @@ var attachEvents = function() {
|
|||
|
||||
//links in bars, or those with data-role become buttons
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
|
||||
$( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a", e.target )
|
||||
.not( ".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='collapsible')", e.target ).collapsible();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='controlgroup')", e.target ).controlgroup({ excludeInvisible: false });
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='fieldcontain')", e.target ).fieldcontain();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
|
||||
if( $( ":jqmData(position='fixed')", e.target ).length ){
|
||||
$( e.target ).each(function(){
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( "button, [type='button'], [type='submit'], [type='reset'], [type='image']", e.target )
|
||||
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
|
||||
.button();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( "input[type='checkbox'],input[type='radio']", e.target )
|
||||
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
|
||||
.checkboxradio();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( "select:not(:jqmData(role='slider'))", e.target )
|
||||
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
|
||||
.selectmenu();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
( function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
|
||||
var nativeSel = ":jqmData(role='none'), :jqmData(role='nojs')";
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( "input[type='text'], input[type='search'], input[type='number'], input[type='password'], textarea", e.target )
|
||||
.not( ":jqmData(role='none'), :jqmData(role='nojs')" )
|
||||
.textinput();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
(function( $, undefined ) {
|
||||
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
|
||||
//links within content areas
|
||||
$( e.target )
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='listview')", e.target ).listview();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(function( $, undefined ) {
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='navbar')", e.target ).navbar();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
(function( $, undefined ) {
|
||||
|
||||
$( document ).bind( "pagecreate", function( e ){
|
||||
$( document ).bind( "pagecreate enhance", function( e ){
|
||||
$( ":jqmData(role='nojs')", e.target ).addClass( "ui-nojs" );
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -109,4 +109,10 @@
|
|||
], 500);
|
||||
|
||||
});
|
||||
|
||||
test( "checkboxradio controls will create when inside a container that receives an 'enhance' event", function(){
|
||||
ok( $("#fragment").appendTo(".ui-page-active").find(".ui-btn").length );
|
||||
})
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Reference in a new issue