Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 09c2867

Browse files
author
Gabriel Luethje
committed
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.
1 parent ff31431 commit 09c2867

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/styleguide/js/postmessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (self != top) {
3232
aTags[i].onclick = function(e) {
3333
e.preventDefault();
3434
var href = this.getAttribute("href");
35-
if (href != "#") {
35+
if (href.length && href !== "#") {
3636
window.location.replace(href);
3737
}
3838
};

0 commit comments

Comments
 (0)