1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-01-29 11:59:16 +01:00

Links with no href attribute shouldn't cause a 404

A 3rd party script I'm using  [Chosen](http://harvesthq.github.io/chosen/) generates an `a` element without a `href` attribute, which causes a 404 when clicked unless we check for `href.length` in the onclick handler.
This commit is contained in:
Gabriel Luethje 2014-05-07 17:37:49 -07:00
parent ff31431333
commit 09c2867819

View File

@ -32,7 +32,7 @@ if (self != top) {
aTags[i].onclick = function(e) {
e.preventDefault();
var href = this.getAttribute("href");
if (href != "#") {
if (href.length && href !== "#") {
window.location.replace(href);
}
};