Merge branch 'master' into path-fixes

Fixed Conflicts:
	js/jquery.mobile.navigation.js
This commit is contained in:
Kin Blas 2011-06-08 15:10:16 -07:00
commit eb082c27e3
10 changed files with 130 additions and 63 deletions

View file

@ -13,6 +13,7 @@ JQUERY = $(shell grep Library js/jquery.js | sed s'/ \* jQuery JavaScript Librar
# The directory to create the zipped files in and also serves as the filenames
DIR = jquery.mobile-${VER}
nightly: DIR = jquery.mobile
# The output folder for the finished files
OUTPUT = compiled
@ -24,7 +25,6 @@ RMLATEST = echo ""
NIGHTLY_OUTPUT = nightlies/${DATE}
ifeq (${NIGHTLY_OUTPUT}, latest)
RMLATEST = ssh jqadmin@code.origin.jquery.com 'rm -rf /var/www/html/code.jquery.com/mobile/latest'
DIR = jquery.mobile
endif
NIGHTLY_WEBPATH = http://code.jquery.com/mobile/${NIGHTLY_OUTPUT}
@ -136,12 +136,6 @@ zip: init js min css cssmin
# Used by the jQuery team to make the nightly builds
nightly: pull zip
# Create a log that lists the current version according to the code and the git information for the last commit
@@echo $$"\nGit Release Version: " >> ${OUTPUT}/log.txt
@@cat version.txt >> ${OUTPUT}/log.txt
@@echo $$"\nGit Information for this build:" >> ${OUTPUT}/log.txt
@@git log -1 --format=format:"SHA1: %H \nDate: %cd \nTitle: %s" >> ${OUTPUT}/log.txt
# Create the folder to hold the files for the demos
@@mkdir -p ${VER}

View file

@ -72,7 +72,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
//events
collapsibleContain
.bind( "collapse", function( event ){
if( !event.isDefaultPrevented() ){
if( !event.isDefaultPrevented() && $( event.target ).closest( ".ui-collapsible-contain" ).is( collapsibleContain ) ){
event.preventDefault();
collapsibleHeading
.addClass( "ui-collapsible-heading-collapsed" )
@ -89,7 +89,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
}
} )
.bind( "expand", function( event ){
.bind( "expand", function( event ){
if( !event.isDefaultPrevented() ){
event.preventDefault();
collapsibleHeading
@ -114,14 +114,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsibleParent
.jqmData( "collapsiblebound", true )
.bind( "expand", function( event ){
$( this ).find( ".ui-collapsible-contain" )
.not( $( event.target ).closest( ".ui-collapsible-contain" ) )
.not( "> .ui-collapsible-contain .ui-collapsible-contain" )
$( event.target )
.closest( ".ui-collapsible-contain" )
.siblings( ".ui-collapsible-contain" )
.trigger( "collapse" );
} );
var set = collapsibleParent.find( ":jqmData(role=collapsible )" );
var set = collapsibleParent.find( ":jqmData(role=collapsible ):first" );
set.first()
.find( "a:eq(0)" )

View file

@ -4,59 +4,51 @@
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change
*/
(function($, undefined ) {
( function( $, undefined ) {
$.widget( "mobile.dialog", $.mobile.widget, {
options: {
closeBtnText: "Close"
},
_create: function(){
var self = this,
$el = self.element;
_create: function() {
var $el = this.element;
/* class the markup for dialog styling */
this.element
$el
//add ARIA role
.attr("role","dialog")
.addClass('ui-page ui-dialog ui-body-a')
.attr( "role", "dialog" )
.addClass( "ui-page ui-dialog ui-body-a" )
.find( ":jqmData(role=header)" )
.addClass('ui-corner-top ui-overlay-shadow')
.addClass( "ui-corner-top ui-overlay-shadow" )
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" )
.end()
.find('.ui-content:not([class*="ui-body-"])')
.addClass('ui-body-c')
.find( '.ui-content:not([class*="ui-body-"])' )
.addClass( 'ui-body-c' )
.end()
.find( ".ui-content,:jqmData(role='footer')" )
.last()
.addClass('ui-corner-bottom ui-overlay-shadow');
.addClass( "ui-corner-bottom ui-overlay-shadow" );
/* bind events
- clicks and submits should use the closing transition that the dialog opened with
unless a data-transition is specified on the link/form
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
*/
this.element
.bind( "vclick submit", function(e){
var $targetel;
if( e.type == "vclick" ){
$targetel = $(e.target).closest("a");
}
else{
$targetel = $(e.target).closest("form");
}
$el
.bind( "vclick submit", function( e ) {
var $target = $( e.target ).closest( e.type === "vclick" ? "a" : "form" );
if( $targetel.length && !$targetel.jqmData("transition") ){
if( $target.length && ! $target.jqmData( "transition" ) ) {
var active = $.mobile.urlHistory.getActive() || {};
$targetel
.attr("data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
.attr("data-" + $.mobile.ns + "direction", "reverse");
$target
.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
.attr( "data-" + $.mobile.ns + "direction", "reverse" );
}
});
},
//close method goes back in history
close: function(){
close: function() {
window.history.back();
}
});
})( jQuery );
})( jQuery );

View file

@ -5,6 +5,10 @@
* http://jquery.org/license
*/
(function($, undefined ) {
//Keeps track of the number of lists per page UID
//This allows support for multiple nested list in the same page
//https://github.com/jquery/jquery-mobile/issues/1617
var listCountPerPage = {};
$.widget( "mobile.listview", $.mobile.widget, {
options: {
@ -189,23 +193,31 @@ $.widget( "mobile.listview", $.mobile.widget, {
_idStringEscape: function( str ){
return str.replace(/[^a-zA-Z0-9]/g, '-');
},
_createSubPages: function() {
var parentList = this.element,
parentPage = parentList.closest( ".ui-page" ),
parentId = parentPage.jqmData( "url" ),
parentUrl = parentPage.jqmData( "url" ),
parentId = parentUrl || parentPage[ 0 ][ $.expando ],
parentListId = parentList.attr( "id" ),
o = this.options,
dns = "data-" + $.mobile.ns,
self = this,
persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" );
if ( typeof( listCountPerPage[ parentId ] ) === 'undefined' ) {
listCountPerPage[ parentId ] = -1;
}
parentListId = parentListId || ++listCountPerPage[ parentId ];
$( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) {
var list = $( this ),
listId = list.attr( "id" ) || parentListId + "-" + i,
parent = list.parent(),
nodeEls = $( list.prevAll().toArray().reverse() ),
nodeEls = nodeEls.length ? nodeEls : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ),
title = nodeEls.first().text(),//url limits to first 30 chars of text
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i),
id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId;
theme = list.jqmData( "theme" ) || o.theme,
countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme,
newPage = list.detach()

View file

@ -80,22 +80,40 @@
<ul data-nstest-role="listview" data-nstest-inset="true">
<li>Item 1</li>
<li>Item 2</li>
<li>Parent Item
<li>Item 3
<ul data-nstest-role="listview">
<li>Sub Item 10</li>
<li>Sub Item 11</li>
<li>Sub Item 12</li>
<li>Item A-3-0</li>
<li>Item A-3-1</li>
<li>Item A-3-2</li>
</ul>
</li>
</ul>
<ul data-nstest-role="listview" data-nstest-inset="true">
<li>Item 3</li>
<li>Item 4</li>
<li>Parent Item
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3
<ul data-nstest-role="listview">
<li>Sub Item 20</li>
<li>Sub Item 21</li>
<li>Sub Item 22</li>
<li>Item B-3-0
<ul data-nstest-role="listview">
<li>Item B-3-0-0</li>
<li>Item B-3-0-1
<ul data-nstest-role="listview">
<li>Item B-3-0-1-0</li>
<li>Item B-3-0-1-1</li>
<li>Item B-3-0-1-2</li>
</ul>
</li>
<li>Item B-3-0-2</li>
</ul>
</li>
<li>Item B-3-1
<ul data-nstest-role="listview">
<li>Item B-3-1-0</li>
<li>Item B-3-1-1</li>
<li>Item B-3-1-2</li>
</ul>
</li>
<li>Item B-3-2</li>
</ul>
</li>
</ul>

View file

@ -63,8 +63,8 @@
function(){
ok($('#nested-list-test').hasClass('ui-page-active'), "makes nested list test page active");
ok($(':jqmData(url="nested-list-test&ui-page=More-animals-0")').length == 1, "Adds first UL to the page");
ok($(':jqmData(url="nested-list-test&ui-page=Groups-of-animals-1")').length == 1, "Adds second nested UL to the page");
ok($(':jqmData(url="nested-list-test&ui-page=0-0")').length == 1, "Adds first UL to the page");
ok($(':jqmData(url="nested-list-test&ui-page=0-1")').length == 1, "Adds second nested UL to the page");
start();
}
]);
@ -82,7 +82,7 @@
},
function(){
var $new_page = $(':jqmData(url="nested-list-test&ui-page=More-animals-0")');
var $new_page = $(':jqmData(url="nested-list-test&ui-page=0-0")');
ok($new_page.hasClass('ui-page-active'), 'Makes the nested page the active page.');
ok($('.ui-listview', $new_page).find(":contains('Rhumba of rattlesnakes')").length == 1, "The current page should have the proper text in the list.");
@ -95,7 +95,7 @@
asyncTest( "should go back to top level when the back button is clicked", function() {
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#nested-list-test&ui-page=More-animals-0");
$.testHelper.openPage("#nested-list-test&ui-page=0-0");
},
function(){
@ -113,7 +113,7 @@
ok($('#nested-list-test .linebreaknode').text() === "More animals", 'Text should be "More animals"');
});
asyncTest( "Multiple nested lists on a page", function() {
asyncTest( "Multiple nested lists on a page with same labels", function() {
$.testHelper.pageSequence([
function(){
// https://github.com/jquery/jquery-mobile/issues/1617
@ -121,9 +121,12 @@
},
function(){
// Click on the link of the third li element
$('.ui-page-active li:eq(2) a:eq(0)').click();
equal($('.ui-page-active .ui-content .ui-listview li').text(), "Sub Item 10Sub Item 11Sub Item 12", 'Text should be "Sub Item 10Sub Item 11Sub Item 12"');
},
function(){
equal($('.ui-page-active .ui-content .ui-listview li').text(), "Item A-3-0Item A-3-1Item A-3-2", 'Text should be "Item A-3-0Item A-3-1Item A-3-2"');
start();
}
]);
@ -387,4 +390,4 @@
}, 1000);
});
})(jQuery);
})(jQuery);

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="changepage-data" data-nstest-role="page"> </div>
</body>
</html>

View file

@ -422,4 +422,41 @@
}
], 1000);
});
asyncTest( "query data passed as string to changePage is appended to URL", function(){
$.testHelper.pageSequence([
// open our test page
function(){
$.mobile.changePage( "form-tests/changepage-data.html", {
data: "foo=1&bar=2"
} );
},
function(){
same(location.hash, "#form-tests/changepage-data.html?foo=1&bar=2");
start();
}
]);
});
asyncTest( "query data passed as object to changePage is appended to URL", function(){
$.testHelper.pageSequence([
// open our test page
function(){
$.mobile.changePage( "form-tests/changepage-data.html", {
data: {
foo: 3,
bar: 4
}
} );
},
function(){
same(location.hash, "#form-tests/changepage-data.html?foo=3&bar=4");
start();
}
]);
});
})(jQuery);

View file

@ -14,14 +14,14 @@
.ui-mobile-viewport { margin: 0; overflow-x: hidden; -webkit-text-size-adjust: none; -ms-text-size-adjust:none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
/* "page" containers - full-screen views, one should always be in view post-pageload */
.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; height: auto !important; height: 100%; position: absolute; display: none; border: 0; }
.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; position: absolute; display: none; border: 0; }
.ui-mobile .ui-page-active { display: block; overflow: visible; }
/*orientations from js are available */
.portrait,
.portrait .ui-page,
.landscape,
.landscape .ui-page { min-height: 100%; height: auto !important; height: 100%; }
.landscape .ui-page { min-height: 100%; }
/* loading screen */
.ui-loading .ui-mobile-viewport { overflow: hidden !important; }

View file

@ -7,6 +7,7 @@
.ui-select select { position: absolute; left: -9999px; top: -9999px; }
.ui-select .ui-btn { overflow: hidden; }
.ui-select .ui-btn select { cursor: pointer; -webkit-appearance: button; left: 0; top:0; width: 100%; height: 100%; text-indent: -999em; opacity: 0.0001; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); }
.ui-select .ui-btn option { text-indent: 0; }
.ui-select .ui-btn select.ui-select-nativeonly { opacity: 1; text-indent: 0; }
.ui-select .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; }