Permalink
Browse files

Revert "Introduce and use the event "enhancecomplete""

This reverts commit 394273e.
  • Loading branch information...
gabrielschulhof committed Nov 4, 2012
1 parent 394273e commit 1126621937a3106724c6907fee463a78d5894cbf
@@ -304,8 +304,6 @@ $( document ).bind( "pagecreate create", function( e ) {
.jqmEnhanceable()
.not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
.buttonMarkup();
-
- $( e.target ).trigger( "enhancecomplete", "buttonMarkup" );
});
})( jQuery );
View
@@ -7,6 +7,7 @@
define( [ "jquery",
"../jquery.mobile.buttonMarkup",
+ "./forms/button",
"../jquery.mobile.widget" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
@@ -100,52 +101,8 @@ define( [ "jquery",
}
});
- // Defer enhancement of controlgroups until all dependent widgets have completed their enhancement
- var enhKey = "controlgroup_enhancementDeps";
-
- // Retrieve (and initialize if not present) information about completed depdencies for a given target
- function getEnhancementDeps( $target ) {
- var deps = $target.jqmData( enhKey );
-
- if ( !deps ) {
- deps = {
- deferred: $.Deferred(),
- deps: {}
- };
- $target.jqmData( enhKey, deps );
- }
-
- return deps;
- }
-
- // Record that a dependency has completed and resolve the deferred when all listed dependencies are complete
- $( document ).bind( "enhancecomplete", function( e, data ) {
- var deps = [ "button", "checkboxradio", "buttonMarkup", "select" ], idx,
- $target = $( e.target ),
- enhancementDeps = getEnhancementDeps( $target );
-
- enhancementDeps.deps[ data ] = true;
-
- for ( idx = deps.length - 1 ; idx > -1 ; idx-- ) {
- if ( !enhancementDeps.deps[ deps[ idx ] ] ) {
- break;
- }
- }
-
- if ( -1 === idx ) {
- enhancementDeps.deferred.resolve();
- }
- });
-
- // Wait for dependent widgets inside e.target to become enhanced before enhancing controlgroups
$( document ).bind( "pagecreate create", function( e ) {
- var $target = $( e.target ),
- enhancementDeps = getEnhancementDeps( $target );
-
- enhancementDeps.deferred.done( function() {
- $.mobile.controlgroup.prototype.enhanceWithin( e.target, true );
- $target.jqmRemoveData( enhKey );
- });
+ $.mobile.controlgroup.prototype.enhanceWithin( e.target, true );
});
})(jQuery);
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
@@ -160,7 +160,6 @@ $.widget( "mobile.button", $.mobile.widget, {
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
$.mobile.button.prototype.enhanceWithin( e.target, true );
- $( e.target ).trigger( "enhancecomplete", "button" );
});
})( jQuery );
@@ -211,7 +211,6 @@ $.widget( "mobile.checkboxradio", $.mobile.checkboxradio, $.mobile.behaviors.for
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
$.mobile.checkboxradio.prototype.enhanceWithin( e.target, true );
- $( e.target ).trigger( "enhancecomplete", "checkboxradio" );
});
})( jQuery );
@@ -272,7 +272,6 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, $.mobile.behaviors.formReset
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
$.mobile.selectmenu.prototype.enhanceWithin( e.target, true );
- $( e.target ).trigger( "enhancecomplete", "select" );
});
})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

0 comments on commit 1126621

Please sign in to comment.