Permalink
Browse files

Page: remove old page based enhancer

  • Loading branch information...
arschmitz committed May 6, 2015
1 parent e518e9f commit f995b9133469661b75b9a100b92a163d69a35976
Showing with 0 additions and 116 deletions.
  1. +0 −65 js/helpers.js
  2. +0 −51 js/widgets/page.js
View
@@ -265,71 +265,6 @@ $.fn.extend( {
$.removeWithDependents( this );
},
// Enhance child elements
enhanceWithin: function() {
var index,
widgetElements = {},
keepNative = $.mobile.page.prototype.keepNativeSelector(),
that = this;
// Add no js class to elements
if ( $.mobile.nojs ) {
$.mobile.nojs( this );
}
// Bind links for ajax nav
if ( $.mobile.links ) {
$.mobile.links( this );
}
// Degrade inputs for styleing
if ( $.mobile.degradeInputsWithin ) {
$.mobile.degradeInputsWithin( this );
}
// Run buttonmarkup
if ( $.fn.buttonMarkup ) {
this.find( $.fn.buttonMarkup.initSelector ).not( keepNative )
.jqmEnhanceable().buttonMarkup();
}
// Add classes for fieldContain
if ( $.fn.fieldcontain ) {
this.find( ":jqmData(role='fieldcontain')" ).not( keepNative )
.jqmEnhanceable().fieldcontain();
}
// Enhance widgets
$.each( $.mobile.widgets, function( name, constructor ) {
// If initSelector not false find elements
if ( constructor.initSelector ) {
// Filter elements that should not be enhanced based on parents
var elements = $.mobile.enhanceable( that.find( constructor.initSelector ) );
// If any matching elements remain filter ones with keepNativeSelector
if ( elements.length > 0 ) {
// $.mobile.page.prototype.keepNativeSelector is deprecated this is just for backcompat
// Switch to $.mobile.keepNative in 1.5 which is just a value not a function
elements = elements.not( keepNative );
}
// Enhance whatever is left
if ( elements.length > 0 ) {
widgetElements[ constructor.prototype.widgetName ] = elements;
}
}
} );
for ( index in widgetElements ) {
widgetElements[ index ][ index ]();
}
return this;
},
addDependents: function( newDependents ) {
$.addDependents( this, newDependents );
},
View
@@ -32,36 +32,6 @@
}
} )( function( $ ) {
$.mobile.widgets = {};
var originalWidget = $.widget,
// Record the original, non-mobileinit-modified version of $.mobile.keepNative
// so we can later determine whether someone has modified $.mobile.keepNative
keepNativeFactoryDefault = $.mobile.keepNative;
$.widget = ( function( orig ) {
return function() {
var constructor = orig.apply( this, arguments ),
name = constructor.prototype.widgetName;
constructor.initSelector = ( ( constructor.prototype.initSelector !== undefined ) ?
constructor.prototype.initSelector : ":jqmData(role='" + name + "')");
$.mobile.widgets[ name ] = constructor;
return constructor;
};
} )( $.widget );
// Make sure $.widget still has bridge and extend methods
$.extend( $.widget, originalWidget );
// For backcompat remove in 1.5
$.mobile.document.on( "create", function( event ) {
$( event.target ).enhanceWithin();
} );
$.widget( "mobile.page", {
version: "@VERSION",
@@ -182,27 +152,6 @@ $.widget( "mobile.page", {
// set the page container background to the page theme
setContainerBackground: function( theme ) {
this.element.parent().pagecontainer( { "theme": theme || this.options.theme } );
},
// Deprecated in 1.4 remove in 1.5
keepNativeSelector: function() {
var options = this.options,
keepNative = $.trim( options.keepNative || "" ),
globalValue = $.trim( $.mobile.keepNative ),
optionValue = $.trim( options.keepNativeDefault ),
// Check if $.mobile.keepNative has changed from the factory default
newDefault = ( keepNativeFactoryDefault === globalValue ?
"" : globalValue ),
// If $.mobile.keepNative has not changed, use options.keepNativeDefault
oldDefault = ( newDefault === "" ? optionValue : "" );
// Concatenate keepNative selectors from all sources where the value has
// changed or, if nothing has changed, return the default
return ( ( keepNative ? [ keepNative ] : [] )
.concat( newDefault ? [ newDefault ] : [] )
.concat( oldDefault ? [ oldDefault ] : [] )
.join( ", " ) );
}
} );

0 comments on commit f995b91

Please sign in to comment.