deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-968 refactored
Date Sat, 08 Aug 2015 10:05:37 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master f7c0f1b3f -> 3b355587a


DELTASPIKE-968 refactored

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/3b355587
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/3b355587
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/3b355587

Branch: refs/heads/master
Commit: 3b355587a07d6a97d5a01ce4a82d67a616512f0a
Parents: f7c0f1b
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Sat Aug 8 12:05:24 2015 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Sat Aug 8 12:05:24 2015 +0200

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js       | 46 ++++++++------------
 1 file changed, 17 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/3b355587/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index b90a1e7..3e55f7e 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -100,10 +100,16 @@ window.dswh = window.dswh || {
                     for (var i = 0; i < links.length; i++) {
                         var link = links[i];
 
-                        if (storeWindowTreeEnabled) {
+                        if (dswh.strategy.CLIENTWINDOW.isHrefDefined(link) === true) {
                             if (!link.onclick) {
                                 link.onclick = function() {
-                                    dswh.strategy.CLIENTWINDOW.storeWindowTree();
+                                    if (storeWindowTreeEnabled) {
+                                        dswh.strategy.CLIENTWINDOW.storeWindowTree();
+                                    }
+                                    if (tokenizedRedirectEnabled) {
+                                        dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
+                                        return false;
+                                    }
                                     return true;
                                 };
                             } else {
@@ -117,34 +123,16 @@ window.dswh = window.dswh || {
                                             //ie handling added
                                             evt = evt || window.event;
 
-                                            return dswh.strategy.CLIENTWINDOW.storeWindowTree()
&& oldonclick.bind(this)(evt);
-                                        };
-                                    })();
-                                }
-                            }
-                        }
-
-                        if (tokenizedRedirectEnabled && dswh.strategy.CLIENTWINDOW.tokenizedRedirectRequired(link)
=== true) {
-                            if (!link.onclick) {
-                                link.onclick = function() {
-                                    dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
-                                    return false;
-                                };
-                            } else {
-                                // prevent double decoration
-                                if (!("" + link.onclick).match(".*tokenizedRedirect.*"))
{
-                                    //the function wrapper is important otherwise the
-                                    //last onclick handler would be assigned to oldonclick
-                                    (function storeEvent() {
-                                        var oldonclick = link.onclick;
-                                        link.onclick = function(evt) {
-                                            //ie handling added
-                                            evt = evt || window.event;
-
                                             var proceed = oldonclick.bind(this)(evt);
                                             if (typeof proceed === 'undefined' || proceed
=== true) {
-                                                dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
-                                                return false;
+                                                if (storeWindowTreeEnabled) {
+                                                    dswh.strategy.CLIENTWINDOW.storeWindowTree();
+                                                }
+                                                
+                                                if (tokenizedRedirectEnabled) {
+                                                    dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
+                                                    return false;
+                                                }
                                             }
                                             return proceed;
                                         };
@@ -156,7 +144,7 @@ window.dswh = window.dswh || {
                 }
             },
 
-            tokenizedRedirectRequired : function(link) {
+            isHrefDefined : function(link) {
                 // skip link without href
                 if (link.href && link.href.length > 0) {
                     return true;


Mime
View raw message