Skip to content

Commit ff54a32

Browse files
committed
<CaptureClicks> now ignores href="#" by default in non-HashEnvironment apps.
1 parent 8fc925c commit ff54a32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/CaptureClicks.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var React = require('react');
44
var urllite = require('urllite/lib/core');
55
var Environment = require('./environment');
6+
var HashEnvironment = require('./environment/HashEnvironment');
67
var assign = Object.assign || require('object-assign');
78

89
/**
@@ -70,6 +71,11 @@ var CaptureClicks = React.createClass({
7071
return;
7172
}
7273

74+
// Ignore hash (used often instead of javascript:void(0) in strict CSP envs)
75+
if (el.href === '#' && !(this.props.environment instanceof HashEnvironment)) {
76+
return;
77+
}
78+
7379
// Use a regular expression to parse URLs instead of relying on the browser
7480
// to do it for us (because IE).
7581
var url = urllite(el.href);

0 commit comments

Comments
 (0)