From 4294aea422560fb2a5d38d216523ebb20b4527e2 Mon Sep 17 00:00:00 2001 From: Sora Yang Date: Wed, 4 Nov 2015 10:41:36 +0800 Subject: [PATCH 1/3] code review --- src/af.ui.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/af.ui.js b/src/af.ui.js index c010fcbf5..328778d21 100644 --- a/src/af.ui.js +++ b/src/af.ui.js @@ -860,10 +860,11 @@ //Add the back button if it's not there if(hdr.find(".backButton").length===1) return; hdr.prepend("" + this.backButtonText + ""); - //Fix device click no response issue + //Fix device click no response issue, just register an event and do nothing hdr.on("click", ".backButton", function() { - if(this.useInternalRouting) - this.goBack(this); + /**Do nothing, event will be called later in + * $(document).on("click", ".backButton, [data-back]", function(){...}); + */ }); } else { From 3588f2fc0c2389feb7d7675533c7738cc09b3fa5 Mon Sep 17 00:00:00 2001 From: Sora Yang Date: Wed, 4 Nov 2015 23:13:55 +0800 Subject: [PATCH 2/3] fix no 'panelunload' event when panel removed active. --- src/af.ui.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/af.ui.js b/src/af.ui.js index 328778d21..52da42bfe 100644 --- a/src/af.ui.js +++ b/src/af.ui.js @@ -972,11 +972,13 @@ if(!back){ this.classList.remove("active"); //If 'this' is view, then find active panel and remove active from it - var activePanel = $(this).find(".active").get(0); - if (undefined !== activePanel) { - activePanel.classList.remove("active"); + var tmpActive = $(this).find(".active").get(0); + if (undefined !== tmpActive) { + $(tmpActive).trigger("panelunload", [back]); + tmpActive.classList.remove("active"); } - $(this).trigger("panelunload", [back]); + //Below trigger will be called when 'to animation' done + //$(this).trigger("panelunload", [back]); } else{ this.classList.add("active"); @@ -1002,6 +1004,7 @@ //Fixes #850, #860, #873 var tmpActive = $(hide).find(".active").get(0); if (undefined !== tmpActive) { + $(tmpActive).trigger("panelunload", [back]); tmpActive.classList.remove("active"); } @@ -1013,9 +1016,10 @@ } this.classList.remove("active"); //If 'hide' is view, then find active panel and remove active from it - var activePanel = $(this).find(".active").get(0); - if (undefined !== activePanel) { - activePanel.classList.remove("active"); + var tmpActive = $(this).find(".active").get(0); + if (undefined !== tmpActive) { + $(tmpActive).trigger("panelunload", [back]); + tmpActive.classList.remove("active"); } $(hide).trigger("panelload", [back]); $(hide).addClass("active"); From e49b8c8c2b34e5b82d925b1554bc68c418b3bc4e Mon Sep 17 00:00:00 2001 From: Sora Yang Date: Wed, 4 Nov 2015 23:50:51 +0800 Subject: [PATCH 3/3] code review --- src/af.ui.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/af.ui.js b/src/af.ui.js index 52da42bfe..492ba24c5 100644 --- a/src/af.ui.js +++ b/src/af.ui.js @@ -860,12 +860,6 @@ //Add the back button if it's not there if(hdr.find(".backButton").length===1) return; hdr.prepend("" + this.backButtonText + ""); - //Fix device click no response issue, just register an event and do nothing - hdr.on("click", ".backButton", function() { - /**Do nothing, event will be called later in - * $(document).on("click", ".backButton, [data-back]", function(){...}); - */ - }); } else { hdr.find(".backButton").remove();