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-1044 ClientWindow - skip links with empty href
Date Mon, 21 Dec 2015 02:16:36 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 7c48cb825 -> cc0da5e37


DELTASPIKE-1044 ClientWindow - skip links with empty href

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

Branch: refs/heads/master
Commit: cc0da5e37ffa81d92afc3a99a00c4adc9d3c24ad
Parents: 7c48cb8
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon Dec 21 03:16:26 2015 +0100
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon Dec 21 03:16:26 2015 +0100

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js       | 25 ++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cc0da5e3/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 7875eea..7bc2d97 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
@@ -181,12 +181,29 @@ window.dswh = window.dswh || {
             },
 
             isHrefDefined : function(link) {
-                // skip link without href
-                if (link.href && link.href.length > 0) {
-                    return true;
+
+                var href = link.getAttribute("href");
+
+                if (!href || href === null) {
+                    return false;
                 }
 
-                return false;
+                // trim
+                href = href.replace(/^\s+|\s+$/g, '');
+
+                if (href === '') {
+                    return false;
+                }
+
+                if (href === '#') {
+                    return false;
+                }
+
+                if (href.lastIndexOf('javascript:', 0) === 0) {
+                    return false;
+                }
+
+                return true;
             },
 
             tokenizedRedirect : function(link) {


Mime
View raw message