Permalink
Browse files

Make class check compatible with uglifier - Fix #346

  • Loading branch information...
1 parent 9ed5712 commit d0a67a5ec5fdd3008c4e0fdcc84c7ea2bf99777b @reed reed committed Feb 14, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/assets/javascripts/turbolinks.js.coffee
View
4 lib/assets/javascripts/turbolinks.js.coffee
@@ -242,7 +242,7 @@ browserCompatibleDocumentParser = ->
# is used to fill in the missing attributes (protocol, host, port).
class ComponentUrl
constructor: (@original = document.location.href) ->
- return @original if @original.constructor.name is 'ComponentUrl'
+ return @original if @original.constructor.name is @constructor.name
@_parse()
withoutHash: -> @href.replace @hash, ''
@@ -270,7 +270,7 @@ class Link extends ComponentUrl
Link.HTML_EXTENSIONS
constructor: (@link) ->
- return @link if @link.constructor.name is 'Link'
+ return @link if @link.constructor.name is @constructor.name
@original = @link.href
super

2 comments on commit d0a67a5

@dudeman

You should definitely just compare the functions and not the name. function.name is a non standard property https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
And of course not supported in IE.

@reed

Figures.

Fixed in c5cda21. Thanks.

Please sign in to comment.