From 09c286781950c6f105e2fe103731825488a67f9f Mon Sep 17 00:00:00 2001 From: Gabriel Luethje Date: Wed, 7 May 2014 17:37:49 -0700 Subject: [PATCH] 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. --- core/styleguide/js/postmessage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/styleguide/js/postmessage.js b/core/styleguide/js/postmessage.js index 76457e8..115c85e 100644 --- a/core/styleguide/js/postmessage.js +++ b/core/styleguide/js/postmessage.js @@ -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); } };