Showing with 135 additions and 231 deletions.
  1. +0 −1 README.md
  2. +0 −9 css/structure/jquery.mobile.core.css
  3. +1 −1 demos/_assets/js/view-source.js
  4. +2 −1 js/.jshintrc
  5. +1 −1 js/defaults.js
  6. +7 −2 js/degradeInputs.js
  7. +0 −20 js/fieldContain.js
  8. +0 −65 js/helpers.js
  9. +1 −2 js/index.php
  10. +0 −4 js/jquery.mobile.js
  11. +0 −40 js/links.js
  12. +0 −20 js/nojs.js
  13. +0 −3 js/widget.js
  14. +85 −0 js/widgets/enhancer.js
  15. +6 −60 js/widgets/page.js
  16. +31 −1 js/widgets/popup.js
  17. +1 −1 tests/unit/degrade-inputs/index.html
@@ -52,7 +52,6 @@ index 6200fe6..3a4625c 100644
@@ -19,12 +19,6 @@ define([
'./jquery.mobile.listview.filter',
'./jquery.mobile.listview.autodividers',
'./jquery.mobile.nojs',
- './jquery.mobile.forms.checkboxradio',
- './jquery.mobile.forms.button',
- './jquery.mobile.forms.slider',
@@ -73,15 +73,6 @@ div.ui-mobile-viewport {
visibility: hidden;
}

/* Non-js content hiding */
.ui-nojs {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px,1px,1px,1px);
}

/* Loading screen */
.ui-loading .ui-loader {
display: block;
@@ -39,7 +39,7 @@ function attachPopupHandler( popup, sources ) {
});

collapsibleSet.find( "[data-role='collapsible']" ).first().attr( "data-collapsed", "false" );
popup.enhanceWithin();
popup.enhance();
});
}

@@ -21,6 +21,7 @@
"globals": {
"define": false,
"require": false,
"requirejs": false
"requirejs": false,
"jQuery": false
}
}
@@ -25,7 +25,7 @@ define( [ "jquery", "./ns", "json!../package.json" ], function( jQuery, ns, pkg
hideUrlBar: true,

// Keepnative Selector
keepNative: ":jqmData(role='none'), :jqmData(role='nojs')",
keepNative: ":jqmData(role='none')",

// Deprecated in 1.4 remove in 1.5
// Class assigned to page currently in view, and during transitions
@@ -22,8 +22,6 @@ $.mobile.degradeInputs = {
url: false,
week: false
};
// Backcompat remove in 1.5
$.mobile.page.prototype.options.degradeInputs = $.mobile.degradeInputs;

// Auto self-init widgets
$.mobile.degradeInputsWithin = function( target ) {
@@ -50,6 +48,13 @@ $.mobile.degradeInputsWithin = function( target ) {

};

$.fn.enhance = (function( orig ) {
return function() {
$.mobile.degradeInputsWithin( this );
return orig.apply( this, arguments );
};
})( $.fn.enhance );

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});

This file was deleted.

@@ -227,71 +227,6 @@ define( [ "jquery", "./ns", "jquery-ui/jquery.ui.core" ], function( jQuery ) {
$.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 );
},
@@ -22,6 +22,7 @@
'helpers.js',
'data.js',
'animationComplete.js',
'widgets/enhancer.js',
'widgets/page.js',
'widgets/page.dialog.js',
'widgets/loader.js',
@@ -45,7 +46,6 @@
'transitions/visuals/flip.js',
'transitions/visuals/flow.js',
'transitions/visuals/turn.js',
'degradeInputs.js',
'widgets/dialog.js',
'widgets/collapsible.js',
'widgets/addFirstLastClasses.js',
@@ -73,7 +73,6 @@
'widgets/filterable.backcompat.js',
'buttonMarkup.js',
'widgets/controlgroup.js',
'links.js',
'widgets/toolbar.js',
'widgets/fixedToolbar.js',
'widgets/fixedToolbar.workarounds.js',
@@ -13,18 +13,15 @@ define([
"./transitions/visuals",
"./animationComplete",
"./navigation",
"./degradeInputs",
"./widgets/page.dialog",
"./widgets/dialog",
"./widgets/collapsible",
"./widgets/collapsibleSet",
"./fieldContain",
"./grid",
"./widgets/navbar",
"./widgets/listview",
"./widgets/listview.autodividers",
"./widgets/listview.hidedividers",
"./nojs",
"./widgets/forms/checkboxradio",
"./widgets/forms/button",
"./widgets/forms/slider",
@@ -38,7 +35,6 @@ define([
"./widgets/forms/select",
"./buttonMarkup",
"./widgets/controlgroup",
"./links",
"./widgets/toolbar",
"./widgets/fixedToolbar",
"./widgets/fixedToolbar.workarounds",

This file was deleted.

This file was deleted.

@@ -37,9 +37,6 @@ $.extend( $.Widget.prototype, {
}
});

//TODO: Remove in 1.5 for backcompat only
$.mobile.widget = $.Widget;

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
@@ -0,0 +1,85 @@
//>>description: Auto enhancement for widgets
//>>label: Enhancer
//>>group: Widgets
(function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([ "jquery", "jquery-ui/jquery.ui.widget" ], factory );
} else {

// Browser globals
factory( jQuery );
}
}(function( $ ) {

var plugin = {
enhance: function() {

// Call the default enhancer function
$.fn.enhance.defaultFunction.apply( this, arguments );

// Loop over and execute any hooks that exist
for ( var i = 0; i < $.fn.enhance.hooks.length; i++ ) {
$.fn.enhance.hooks[ i ].apply( this, arguments );
}
return this;
}
};

// Generate the init selector to be used by a widget
plugin.enhance.initGenerator = function( widgetName ) {
return "[data-" + $.mobile.ns + "role='" + widgetName + "']";
};

// Check if the enhancer has already been defined if it has copy its hooks if not
// define an empty array
plugin.enhance.hooks = ( $.fn.enhance && $.fn.enhance.hooks ) ? $.fn.enhance.hooks : [];

// Default function
plugin.enhance.defaultFunction = function(){
var that = this.addBack();

// Enhance widgets
function crawlChildren( _childConstructors ) {
$.each( _childConstructors, function( index, constructor ) {
that.find( constructor.prototype.initSelector ||
$.fn.enhance.initGenerator( constructor.prototype.widgetName )
)[ constructor.prototype.widgetName ]();
if ( constructor._childConstructors && constructor._childConstructors.length > 0 ) {
crawlChildren( constructor._childConstructors );
}
});
}
crawlChildren( $.Widget._childConstructors );
};

// This is for backcompat remove in 1.6
plugin.enhanceWithin = function() {
return this.children().enhance();
};

$.extend( $.fn, plugin );

$.extend( $.Widget.prototype, {
_getCreateOptions: function() {
var option, value,

// Get all data at once avoid multiple lookups http://jsperf.com/jqm-data-bulk
data = this.element.data(),
options = {};

// Translate data-attributes to options
for ( option in this.options ) {
value = data[ option ];
if ( value !== undefined ) {
options[ option ] = value;
}
}

return options;
}
});

return plugin;
}));