Skip to content

Commit e1cb348

Browse files
author
zhangxinxu
committed
no id page back
make no-id page fallback stronger
1 parent 4c99ac6 commit e1cb348

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobilebone",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Bone main for mobile web APP with a sigle page mode.",
55
"main": "src/mobilebone.js",
66
"directories": {

src/mobilebone.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*
4141
* @type string
4242
**/
43-
Mobilebone.VERSION = '2.0.2';
43+
Mobilebone.VERSION = '2.0.3';
4444

4545
/**
4646
* Whether catch attribute of href from element with tag 'a'
@@ -727,8 +727,7 @@
727727
if (hasInited == true) return 'Don\'t repeat initialization!';
728728
var hash = location.hash.replace("#&", "#"), ele_in = null;
729729
if (hash == "" || hash == "#") {
730-
store._initPage = document.querySelector("." + this.classPage);
731-
this.transition(store._initPage);
730+
this.transition(document.querySelector("." + this.classPage));
732731
} else if (isSimple.test(hash) == true && (ele_in = document.querySelector(hash)) && ele_in.classList.contains(this.classPage)) { // 'ele_in' must be a page element
733732
this.transition(ele_in);
734733
} else {
@@ -912,9 +911,9 @@
912911
window.addEventListener("popstate", function() {
913912
var hash = location.hash.replace("#&", "").replace("#", ""), page_in = null;
914913
if (hash == "") {
915-
// if no hash, get init page as 'page_in'
916-
page_in = store._initPage;
917-
if (!page_in) return;
914+
// if no hash, get first page as 'page_in'
915+
page_in = document.querySelector("." + Mobilebone.classPage);
916+
if (page_in.id) return;
918917
} else {
919918
page_in = store[hash];
920919
}

0 commit comments

Comments
 (0)