Skip to content

Commit

Permalink
Debug pushstate when there are more than one link in a page (#26)
Browse files Browse the repository at this point in the history
* Debug pushstate when there are more than one link in a page
* Before, if a page had more than one link, any click would drive to the ressource related to last link in the page
  • Loading branch information
liitfr authored and jescalan committed Dec 14, 2016
1 parent ef4657c commit 3209e3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ if (window.history) {
el.onclick = function (e) {
e.preventDefault()
var parser = document.createElement('a')
parser.href = el.href
var matchedTpl = _getTemplate(el.pathname)
parser.href = e.target
var matchedTpl = _getTemplate(e.target.pathname)
if (matchedTpl) {
document.write(matchedTpl)
document.close()
history.pushState({}, '', el.href)
history.pushState({}, '', e.target)
} else {
window.location = el.href
window.location = e.target
}
}
}
Expand Down

0 comments on commit 3209e3f

Please sign in to comment.