diff options
author | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-06-19 19:36:19 +0400 |
---|---|---|
committer | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-06-19 19:36:19 +0400 |
commit | bc11aee34bca776fab6c9a13c94a92d9c6aac4c6 (patch) | |
tree | bf31adbccf2b65e6aaab721c7a2b2186e91f5223 /js | |
parent | 685c4828d5f8898811503255598fa5ce0c7bc209 (diff) |
Fixes #814 - guard against:
addListener(clickable_non_anchor_element_with_no_anchor_element_ancestors)
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/piwik.js b/js/piwik.js index ec80d3a3c2..84c249a315 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -655,7 +655,7 @@ if (!this.Piwik) { * Handle click event */ function clickHandler(clickEvent) { - var sourceElement, tag, linkType; + var sourceElement, parentElement, tag, linkType; if (!isDefined(clickEvent)) { clickEvent = windowAlias.event; @@ -669,8 +669,9 @@ if (!this.Piwik) { return; } - while ((tag = sourceElement.tagName) != 'A' && tag != 'AREA') { - sourceElement = sourceElement.parentNode; + while ((parentElement = sourceElement.parentNode) && + ((tag = sourceElement.tagName) != 'A' && tag != 'AREA')) { + sourceElement = parentElement; } if (isDefined(sourceElement.href)) { |