Skip to content

Commit

Permalink
Merge pull request turbolinks#117 from stevenbristol/removed_node
Browse files Browse the repository at this point in the history
sometimes a node is clicked, then it is removed from the dom before extractLink can climb it's tree
  • Loading branch information
dhh committed Nov 26, 2012
2 parents ff2b4d2 + 8ba70fa commit 312b3e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/assets/javascripts/turbolinks.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ installClickHandlerLast = (event) ->
handleClick = (event) ->
unless event.defaultPrevented
link = extractLink event
if link.nodeName is 'A' and !ignoreClick(event, link)
if link?.nodeName is 'A' and !ignoreClick(event, link)
visit link.href
event.preventDefault()


extractLink = (event) ->
link = event.target
link = link.parentNode until link is document or link.nodeName is 'A'
link = link.parentNode until link is document or !link or link.nodeName is 'A'
link

samePageLink = (link) ->
Expand Down

0 comments on commit 312b3e9

Please sign in to comment.