Skip to content

Commit eb082c2

Browse files
committed
Merge branch 'master' into path-fixes
Fixed Conflicts: js/jquery.mobile.navigation.js
2 parents 8e1e77b + 93e7afd commit eb082c2

File tree

10 files changed

+130
-63
lines changed

10 files changed

+130
-63
lines changed

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ JQUERY = $(shell grep Library js/jquery.js | sed s'/ \* jQuery JavaScript Librar
1313

1414
# The directory to create the zipped files in and also serves as the filenames
1515
DIR = jquery.mobile-${VER}
16+
nightly: DIR = jquery.mobile
1617

1718
# The output folder for the finished files
1819
OUTPUT = compiled
@@ -24,7 +25,6 @@ RMLATEST = echo ""
2425
NIGHTLY_OUTPUT = nightlies/${DATE}
2526
ifeq (${NIGHTLY_OUTPUT}, latest)
2627
RMLATEST = ssh jqadmin@code.origin.jquery.com 'rm -rf /var/www/html/code.jquery.com/mobile/latest'
27-
DIR = jquery.mobile
2828
endif
2929
NIGHTLY_WEBPATH = http://code.jquery.com/mobile/${NIGHTLY_OUTPUT}
3030

@@ -136,12 +136,6 @@ zip: init js min css cssmin
136136

137137
# Used by the jQuery team to make the nightly builds
138138
nightly: pull zip
139-
# Create a log that lists the current version according to the code and the git information for the last commit
140-
@@echo $$"\nGit Release Version: " >> ${OUTPUT}/log.txt
141-
@@cat version.txt >> ${OUTPUT}/log.txt
142-
@@echo $$"\nGit Information for this build:" >> ${OUTPUT}/log.txt
143-
@@git log -1 --format=format:"SHA1: %H \nDate: %cd \nTitle: %s" >> ${OUTPUT}/log.txt
144-
145139
# Create the folder to hold the files for the demos
146140
@@mkdir -p ${VER}
147141

js/jquery.mobile.collapsible.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
7272
//events
7373
collapsibleContain
7474
.bind( "collapse", function( event ){
75-
if( !event.isDefaultPrevented() ){
75+
if( !event.isDefaultPrevented() && $( event.target ).closest( ".ui-collapsible-contain" ).is( collapsibleContain ) ){
7676
event.preventDefault();
7777
collapsibleHeading
7878
.addClass( "ui-collapsible-heading-collapsed" )
@@ -89,7 +89,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
8989
}
9090

9191
} )
92-
.bind( "expand", function( event ){
92+
.bind( "expand", function( event ){
9393
if( !event.isDefaultPrevented() ){
9494
event.preventDefault();
9595
collapsibleHeading
@@ -114,14 +114,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
114114
collapsibleParent
115115
.jqmData( "collapsiblebound", true )
116116
.bind( "expand", function( event ){
117-
$( this ).find( ".ui-collapsible-contain" )
118-
.not( $( event.target ).closest( ".ui-collapsible-contain" ) )
119-
.not( "> .ui-collapsible-contain .ui-collapsible-contain" )
117+
118+
$( event.target )
119+
.closest( ".ui-collapsible-contain" )
120+
.siblings( ".ui-collapsible-contain" )
120121
.trigger( "collapse" );
122+
121123
} );
122124

123125

124-
var set = collapsibleParent.find( ":jqmData(role=collapsible )" );
126+
var set = collapsibleParent.find( ":jqmData(role=collapsible ):first" );
125127

126128
set.first()
127129
.find( "a:eq(0)" )

js/jquery.mobile.dialog.js

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,51 @@
44
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
55
* Note: Code is in draft form and is subject to change
66
*/
7-
(function($, undefined ) {
7+
( function( $, undefined ) {
88
$.widget( "mobile.dialog", $.mobile.widget, {
99
options: {
1010
closeBtnText: "Close"
1111
},
12-
_create: function(){
13-
var self = this,
14-
$el = self.element;
12+
_create: function() {
13+
var $el = this.element;
1514

1615
/* class the markup for dialog styling */
17-
this.element
16+
$el
1817
//add ARIA role
19-
.attr("role","dialog")
20-
.addClass('ui-page ui-dialog ui-body-a')
18+
.attr( "role", "dialog" )
19+
.addClass( "ui-page ui-dialog ui-body-a" )
2120
.find( ":jqmData(role=header)" )
22-
.addClass('ui-corner-top ui-overlay-shadow')
21+
.addClass( "ui-corner-top ui-overlay-shadow" )
2322
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" )
2423
.end()
25-
.find('.ui-content:not([class*="ui-body-"])')
26-
.addClass('ui-body-c')
24+
.find( '.ui-content:not([class*="ui-body-"])' )
25+
.addClass( 'ui-body-c' )
2726
.end()
2827
.find( ".ui-content,:jqmData(role='footer')" )
2928
.last()
30-
.addClass('ui-corner-bottom ui-overlay-shadow');
29+
.addClass( "ui-corner-bottom ui-overlay-shadow" );
3130

3231
/* bind events
3332
- clicks and submits should use the closing transition that the dialog opened with
3433
unless a data-transition is specified on the link/form
3534
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
3635
*/
37-
this.element
38-
.bind( "vclick submit", function(e){
39-
var $targetel;
40-
if( e.type == "vclick" ){
41-
$targetel = $(e.target).closest("a");
42-
}
43-
else{
44-
$targetel = $(e.target).closest("form");
45-
}
36+
$el
37+
.bind( "vclick submit", function( e ) {
38+
var $target = $( e.target ).closest( e.type === "vclick" ? "a" : "form" );
4639

47-
if( $targetel.length && !$targetel.jqmData("transition") ){
40+
if( $target.length && ! $target.jqmData( "transition" ) ) {
4841
var active = $.mobile.urlHistory.getActive() || {};
49-
$targetel
50-
.attr("data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
51-
.attr("data-" + $.mobile.ns + "direction", "reverse");
42+
$target
43+
.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
44+
.attr( "data-" + $.mobile.ns + "direction", "reverse" );
5245
}
5346
});
54-
5547
},
5648

5749
//close method goes back in history
58-
close: function(){
50+
close: function() {
5951
window.history.back();
6052
}
6153
});
62-
})( jQuery );
54+
})( jQuery );

js/jquery.mobile.listview.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* http://jquery.org/license
66
*/
77
(function($, undefined ) {
8+
//Keeps track of the number of lists per page UID
9+
//This allows support for multiple nested list in the same page
10+
//https://github.com/jquery/jquery-mobile/issues/1617
11+
var listCountPerPage = {};
812

913
$.widget( "mobile.listview", $.mobile.widget, {
1014
options: {
@@ -189,23 +193,31 @@ $.widget( "mobile.listview", $.mobile.widget, {
189193
_idStringEscape: function( str ){
190194
return str.replace(/[^a-zA-Z0-9]/g, '-');
191195
},
192-
196+
193197
_createSubPages: function() {
194198
var parentList = this.element,
195199
parentPage = parentList.closest( ".ui-page" ),
196-
parentId = parentPage.jqmData( "url" ),
200+
parentUrl = parentPage.jqmData( "url" ),
201+
parentId = parentUrl || parentPage[ 0 ][ $.expando ],
202+
parentListId = parentList.attr( "id" ),
197203
o = this.options,
198204
dns = "data-" + $.mobile.ns,
199205
self = this,
200206
persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" );
201207

208+
if ( typeof( listCountPerPage[ parentId ] ) === 'undefined' ) {
209+
listCountPerPage[ parentId ] = -1;
210+
}
211+
parentListId = parentListId || ++listCountPerPage[ parentId ];
212+
202213
$( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) {
203214
var list = $( this ),
215+
listId = list.attr( "id" ) || parentListId + "-" + i,
204216
parent = list.parent(),
205217
nodeEls = $( list.prevAll().toArray().reverse() ),
206218
nodeEls = nodeEls.length ? nodeEls : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ),
207219
title = nodeEls.first().text(),//url limits to first 30 chars of text
208-
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i),
220+
id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId;
209221
theme = list.jqmData( "theme" ) || o.theme,
210222
countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme,
211223
newPage = list.detach()

tests/unit/listview/index.html

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,40 @@ <h1>Basic multiple lists view</h1>
8080
<ul data-nstest-role="listview" data-nstest-inset="true">
8181
<li>Item 1</li>
8282
<li>Item 2</li>
83-
<li>Parent Item
83+
<li>Item 3
8484
<ul data-nstest-role="listview">
85-
<li>Sub Item 10</li>
86-
<li>Sub Item 11</li>
87-
<li>Sub Item 12</li>
85+
<li>Item A-3-0</li>
86+
<li>Item A-3-1</li>
87+
<li>Item A-3-2</li>
8888
</ul>
8989
</li>
9090
</ul>
9191
<ul data-nstest-role="listview" data-nstest-inset="true">
92-
<li>Item 3</li>
93-
<li>Item 4</li>
94-
<li>Parent Item
92+
<li>Item 1</li>
93+
<li>Item 2</li>
94+
<li>Item 3
9595
<ul data-nstest-role="listview">
96-
<li>Sub Item 20</li>
97-
<li>Sub Item 21</li>
98-
<li>Sub Item 22</li>
96+
<li>Item B-3-0
97+
<ul data-nstest-role="listview">
98+
<li>Item B-3-0-0</li>
99+
<li>Item B-3-0-1
100+
<ul data-nstest-role="listview">
101+
<li>Item B-3-0-1-0</li>
102+
<li>Item B-3-0-1-1</li>
103+
<li>Item B-3-0-1-2</li>
104+
</ul>
105+
</li>
106+
<li>Item B-3-0-2</li>
107+
</ul>
108+
</li>
109+
<li>Item B-3-1
110+
<ul data-nstest-role="listview">
111+
<li>Item B-3-1-0</li>
112+
<li>Item B-3-1-1</li>
113+
<li>Item B-3-1-2</li>
114+
</ul>
115+
</li>
116+
<li>Item B-3-2</li>
99117
</ul>
100118
</li>
101119
</ul>

tests/unit/listview/listview_core.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363

6464
function(){
6565
ok($('#nested-list-test').hasClass('ui-page-active'), "makes nested list test page active");
66-
ok($(':jqmData(url="nested-list-test&ui-page=More-animals-0")').length == 1, "Adds first UL to the page");
67-
ok($(':jqmData(url="nested-list-test&ui-page=Groups-of-animals-1")').length == 1, "Adds second nested UL to the page");
66+
ok($(':jqmData(url="nested-list-test&ui-page=0-0")').length == 1, "Adds first UL to the page");
67+
ok($(':jqmData(url="nested-list-test&ui-page=0-1")').length == 1, "Adds second nested UL to the page");
6868
start();
6969
}
7070
]);
@@ -82,7 +82,7 @@
8282
},
8383

8484
function(){
85-
var $new_page = $(':jqmData(url="nested-list-test&ui-page=More-animals-0")');
85+
var $new_page = $(':jqmData(url="nested-list-test&ui-page=0-0")');
8686

8787
ok($new_page.hasClass('ui-page-active'), 'Makes the nested page the active page.');
8888
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 @@
9595
asyncTest( "should go back to top level when the back button is clicked", function() {
9696
$.testHelper.pageSequence([
9797
function(){
98-
$.testHelper.openPage("#nested-list-test&ui-page=More-animals-0");
98+
$.testHelper.openPage("#nested-list-test&ui-page=0-0");
9999
},
100100

101101
function(){
@@ -113,17 +113,20 @@
113113
ok($('#nested-list-test .linebreaknode').text() === "More animals", 'Text should be "More animals"');
114114
});
115115

116-
asyncTest( "Multiple nested lists on a page", function() {
116+
asyncTest( "Multiple nested lists on a page with same labels", function() {
117117
$.testHelper.pageSequence([
118118
function(){
119119
// https://github.com/jquery/jquery-mobile/issues/1617
120120
$.testHelper.openPage("#nested-lists-test");
121121
},
122122

123123
function(){
124+
// Click on the link of the third li element
124125
$('.ui-page-active li:eq(2) a:eq(0)').click();
125-
126-
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"');
126+
},
127+
128+
function(){
129+
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"');
127130
start();
128131
}
129132
]);
@@ -387,4 +390,4 @@
387390
}, 1000);
388391
});
389392

390-
})(jQuery);
393+
})(jQuery);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
</head>
5+
<body>
6+
<div id="changepage-data" data-nstest-role="page"> </div>
7+
</body>
8+
</html>

tests/unit/navigation/navigation_core.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,41 @@
422422
}
423423
], 1000);
424424
});
425+
426+
asyncTest( "query data passed as string to changePage is appended to URL", function(){
427+
428+
$.testHelper.pageSequence([
429+
// open our test page
430+
function(){
431+
$.mobile.changePage( "form-tests/changepage-data.html", {
432+
data: "foo=1&bar=2"
433+
} );
434+
},
435+
436+
function(){
437+
same(location.hash, "#form-tests/changepage-data.html?foo=1&bar=2");
438+
start();
439+
}
440+
]);
441+
});
442+
443+
asyncTest( "query data passed as object to changePage is appended to URL", function(){
444+
445+
$.testHelper.pageSequence([
446+
// open our test page
447+
function(){
448+
$.mobile.changePage( "form-tests/changepage-data.html", {
449+
data: {
450+
foo: 3,
451+
bar: 4
452+
}
453+
} );
454+
},
455+
456+
function(){
457+
same(location.hash, "#form-tests/changepage-data.html?foo=3&bar=4");
458+
start();
459+
}
460+
]);
461+
});
425462
})(jQuery);

themes/default/jquery.mobile.core.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
.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); }
1515

1616
/* "page" containers - full-screen views, one should always be in view post-pageload */
17-
.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; }
17+
.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; }
1818
.ui-mobile .ui-page-active { display: block; overflow: visible; }
1919

2020
/*orientations from js are available */
2121
.portrait,
2222
.portrait .ui-page,
2323
.landscape,
24-
.landscape .ui-page { min-height: 100%; height: auto !important; height: 100%; }
24+
.landscape .ui-page { min-height: 100%; }
2525

2626
/* loading screen */
2727
.ui-loading .ui-mobile-viewport { overflow: hidden !important; }

themes/default/jquery.mobile.forms.select.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
.ui-select select { position: absolute; left: -9999px; top: -9999px; }
88
.ui-select .ui-btn { overflow: hidden; }
99
.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); }
10+
.ui-select .ui-btn option { text-indent: 0; }
1011
.ui-select .ui-btn select.ui-select-nativeonly { opacity: 1; text-indent: 0; }
1112

1213
.ui-select .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; }

0 commit comments

Comments
 (0)