Merge remote branch 'upstream/master' into amd

Conflicts:
	js/jquery.mobile.hashchange.js
This commit is contained in:
Ghislain Seguin 2011-12-15 23:31:35 -08:00
commit e4bf0b1a8e
17 changed files with 1885 additions and 1522 deletions

View file

@ -51,6 +51,9 @@ div.ui-mobile-viewport { overflow-x: hidden; }
.ui-mobile-touch-overflow.ui-native-fixed .ui-content .ui-listview-inset {
margin-top: 1em;
}
.ui-mobile-touch-overflow.ui-native-fixed .ui-header .ui-btn {
z-index: 10;
}
/* loading screen */
.ui-loading .ui-mobile-viewport { overflow: hidden !important; }

View file

@ -280,6 +280,10 @@
<th>data-split-icon</th>
<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
</tr>
<tr>
<th>data-split-theme</th>
<td>swatch letter (a-z)<td>
</tr>
<tr>
<th>data-theme</th>
<td>swatch letter (a-z)</td>

View file

@ -116,7 +116,7 @@ $(document).bind("mobileinit", function(){
<dt><code>defaultDialogTransition</code> <em>string</em>, default: 'pop'</dt>
<dd>Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions by default.</dd>
<dt><code>minScrollBack</code> <em>string</em>, default: 150</dt>
<dt><code>minScrollBack</code> <em>string</em>, default: 250</dt>
<dd>Minimum scroll distance that will be remembered when returning to a page. </dd>
<dt><code>loadingMessage</code> <em>string</em>, default: "loading"</dt>

View file

@ -197,7 +197,7 @@ $(document).bind('mobileinit',function(){
});
</pre></code>
<p>One special case is that of selects. The above sample will prevent any and all augmentation from taking place on select elements in the page if <code>select</code> is included. If you wish to retain the native performance, look/feel of the menu itself and benefit from the visual augmentation of the select button by jQuery Mobile you can set $.mobile.nativeSelectMenu to true in a <code>mobileinit</code> callback as a global setting or use <code>data-native="true"</code> on a case by case basis.</p>
<p>One special case is that of selects. The above sample will prevent any and all augmentation from taking place on select elements in the page if <code>select</code> is included. If you wish to retain the native performance, look/feel of the menu itself and benefit from the visual augmentation of the select button by jQuery Mobile you can set <code>$.mobile.selectmenu.prototype.options.nativeMenu</code> to true in a <code>mobileinit</code> callback as a global setting or use <code>data-native-menu="true"</code> on a case by case basis.</p>

3193
js/jquery.js vendored

File diff suppressed because it is too large Load diff

View file

@ -78,7 +78,6 @@ $.fn.buttonMarkup = function( options ) {
el.removeClass( "ui-link" ).addClass( buttonClass );
buttonInner.className = innerClass;
buttonInner.setAttribute("aria-hidden", "true");
buttonText.className = textClass;
buttonInner.appendChild( buttonText );
@ -190,4 +189,4 @@ $( document ).bind( "pagecreate create", function( e ){
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");
//>>excludeEnd("jqmBuildExclude");

View file

@ -1,4 +1,4 @@
/*
/*
* "core" - The base file for jQm
*/
@ -155,11 +155,24 @@ define(function() {
}
e = e.parentNode;
}
// Return the theme letter we found, if none, return the
// specified default.
return ltr || defaultTheme || "a";
},
// TODO the following $ and $.fn extensions can/probably should be moved into jquery.mobile.core.helpers
//
// Find the closest javascript page element to gather settings data jsperf test
// http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit
// possibly naive, but it shows that the parsing overhead for *just* the page selector vs
// the page and dialog selector is negligable. This could probably be speed up by
// doing a similar parent node traversal to the one found in the inherited theme code above
closestPageData: function( $target ) {
return $target
.closest(':jqmData(role="page"), :jqmData(role="dialog")')
.data("page");
}
});

View file

@ -27,7 +27,7 @@ $.mobile.page.prototype.options.degradeInputs = {
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ){
var page = $(e.target).closest(':jqmData(role="page")').data("page"), options;
var page = $.mobile.closestPageData( $(e.target) );
if( !page ) {
return;

View file

@ -77,8 +77,6 @@
// part of jQuery BBQ, but also be available separately.
(function($,window,undefined){
'$:nomunge'; // Used by YUI compressor.
// Reused string.
var str_hashchange = 'hashchange',

View file

@ -539,8 +539,6 @@ define( [ "jquery.mobile.core", "jquery.mobile.hashchange", "jquery.mobile.event
//reset toPage height back
if( !touchOverflow ){
toPage.height( "" );
// Send focus to the newly shown page
reFocus( toPage );
}
// Jump to top or prev scroll, sometimes on iOS the page has not rendered yet.
@ -1169,6 +1167,12 @@ define( [ "jquery.mobile.core", "jquery.mobile.hashchange", "jquery.mobile.event
//remove initial build class (only present on first pageshow)
$html.removeClass( "ui-mobile-rendering" );
// Send focus to the newly shown page. Moved from promise .done binding in transitionPages
// itself to avoid ie bug that reports offsetWidth as > 0 (core check for visibility)
// despite visibility: hidden addresses issue #2965
// https://github.com/jquery/jquery-mobile/issues/2965
reFocus( toPage );
releasePageTransitionLock();
// Let listeners know we're all done changing the current page.

View file

@ -26,6 +26,7 @@ var dataPropertyName = "virtualMouseBindings",
touchTargetPropertyName = "virtualTouchID",
virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ),
touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ),
mouseEventProps = $.event.props.concat( $.event.mouseHooks.props ),
activeDocHandlers = {},
resetTimerID = 0,
startX = 0,
@ -64,6 +65,12 @@ function createVirtualEvent( event, eventType ) {
oe = event.originalEvent;
props = $.event.props;
// addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280
// https://github.com/jquery/jquery-mobile/issues/3280
if ( t.search(/mouse/) >-1 ) {
props = mouseEventProps;
}
// copy original event properties over to the new event
// this would happen if we could call $.event.fix instead of $.Event
// but we don't have a way to force an event to be fixed multiple times

View file

@ -42,7 +42,7 @@ $.widget( "mobile.widget", {
// TODO remove dependency on the page widget for the keepNative.
// Currently the keepNative value is defined on the page prototype so
// the method is as well
var page = $(target).closest(":jqmData(role='page')").data( "page" ),
var page = $.mobile.closestPageData( $(target) ),
keepNative = (page && page.keepNativeSelector()) || "";
$( this.options.initSelector, target ).not( keepNative )[ this.widgetName ]();

View file

@ -145,4 +145,18 @@
same( $("#encoded").getEncodedText(), "foo&gt;");
same( $("#unencoded").getEncodedText(), "foo");
});
test( "closestPageData returns the parent's page data", function() {
var pageChild = $( "#page-child" );
$( "#parent-page" ).data( "page", { foo: "bar" } );
same( $.mobile.closestPageData( pageChild ).foo, "bar" );
});
test( "closestPageData returns the parent dialog's page data", function() {
var dialogChild = $( "#dialog-child" );
$( "#parent-dialog" ).data( "page", { foo: "bar" } );
same( $.mobile.closestPageData(dialogChild).foo, "bar" );
});
})(jQuery);

View file

@ -35,6 +35,14 @@
<div id="dependent"></div>
<div id="encoded">foo&gt;</div>
<div id="unencoded"><script>foo</script></div>
<div id="parent-page" data-nstest-role="page">
<div id="page-child"></div>
</div>
<div id="parent-dialog" data-nstest-role="dialog">
<div id="dialog-child"></div>
</div>
</div>
</body>
</html>

View file

@ -3,27 +3,41 @@
*/
(function($){
module('jquery.mobile.slider.js');
module('jquery.mobile.slider.js');
test('keepNative elements should not be degraded', function() {
same($('input#not-to-be-degraded').attr("type"), "range");
same($('input#not-to-be-degraded').attr("type"), "range");
});
asyncTest('should degrade input type to a different type, as specified in page options', function(){
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
expect( degradeInputs.length );
// NOTE the initial page is already enhanced (or expected to be) so we load the dialog to enhance it
// and _expect_ that the default page will remain "unreaped". This will break if that assumption changes
$.testHelper.pageSequence([
function() {
$.mobile.changePage( "#dialog" );
},
function() {
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
}
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#page-test-container input').attr("type"), newType, "type attr on page is: " + newType);
$('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#dialog-test-container input').attr("type"), newType, "type attr on dialog is: " + newType);
});
start();
}
]);
});
test('should degrade input type to a different type, as specified in page options', function(){
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
expect( degradeInputs.length );
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
}
$('#test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#test-container input').attr("type"), newType);
});
});
})(jQuery);

View file

@ -25,11 +25,18 @@
<ol id="qunit-tests">
</ol>
<div id="foo" data-nstest-role="page">
<div id="page" data-nstest-role="page">
<input id="not-to-be-degraded" type="range" data-nstest-role="nojs" />
<div id="test-container">
<div id="page-test-container">
</div>
</div>
<div id="dialog" data-nstest-role="dialog">
<div id="dialog-test-container">
</div>
</div>

73
tools/config-props.html Normal file
View file

@ -0,0 +1,73 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Configuration Properties</title>
<link rel="stylesheet" href="../css/themes/default/" />
<style>
.prop { float: left; font-weight: bold; }
.val { float: right; margin-left: 2em; }
.ui-li { overflow: hidden; }
</style>
<script src="../js/jquery.js"></script>
<script src="../js/"></script>
<script>
function simpleEntityEncode( str )
{
return ( str + "" ).replace( /&/, "&amp;" ).replace( /</, "&lt;" ).replace( />/, "&gt" );
}
function getObjectPropsAsArray( obj, doSort )
{
var props = [], prop;
for ( prop in obj ) {
props.push( prop );
}
return doSort ? props.sort() : props;
}
function getPropsAsListviewMarkkup( obj )
{
var props = getObjectPropsAsArray( obj || {}, true ),
propStr = "<ul data-role='listview' data-inset='true'>\n",
prop, val, i;
for ( i = 0; i < props.length; i++ ) {
prop = props[ i ];
val = obj[ prop ],
vtype = typeof val;
if ( vtype !== "function" && vtype !== "object" ) {
propStr += "\t<li><span class='prop'>" + simpleEntityEncode( prop ) + ":</span><span class='val'>" + simpleEntityEncode( val ) + "</span></li>\n";
}
}
return propStr + "</ul>\n";
}
$( document ).bind( "pageinit", function( e ) {
var $content = $( e.target ).find( ".ui-content");
$( "<h2>$.mobile</h2>" ).appendTo( $content );
$( getPropsAsListviewMarkkup( $.mobile ) ).appendTo( $content ).listview();
$( "<h2>$.support</h2>" ).appendTo( $content );
$( getPropsAsListviewMarkkup( $.support ) ).appendTo( $content ).listview();
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header"><h1>Configuration Properties</h1></div>
<div data-role="content">
<p>Below is a dump of the non-function/object properties of the $.mobile and $.support objects. These properties typically control how the jQuery Mobile framework behaves on the various devices/platforms. You can use this page to quickly assess the default support configuration calculated by both jQuery Core and jQuery Mobile.</p>
</div>
</div>
</body>
</html>