Sfoglia il codice sorgente

Fix scrollToTarget when element id has encoded uri components

Thibaut 11 anni fa
parent
commit
e9c9884a13
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      assets/javascripts/views/content/content.coffee

+ 3 - 1
assets/javascripts/views/content/content.coffee

@@ -157,7 +157,9 @@ class app.views.Content extends app.View
       $.stopEvent(event)
 
   findTargetByHash: (hash) ->
-    try $.id decodeURIComponent(hash) catch
+    el = try $.id decodeURIComponent(hash) catch
+    el or= try $.id(hash) catch
+    el
 
   isExternalUrl: (url) ->
     url?[0..5] in ['http:/', 'https:']