浏览代码

Fix scrollToTarget when element id has encoded uri components

Thibaut 11 年之前
父节点
当前提交
e9c9884a13
共有 1 个文件被更改,包括 3 次插入1 次删除
  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)
       $.stopEvent(event)
 
 
   findTargetByHash: (hash) ->
   findTargetByHash: (hash) ->
-    try $.id decodeURIComponent(hash) catch
+    el = try $.id decodeURIComponent(hash) catch
+    el or= try $.id(hash) catch
+    el
 
 
   isExternalUrl: (url) ->
   isExternalUrl: (url) ->
     url?[0..5] in ['http:/', 'https:']
     url?[0..5] in ['http:/', 'https:']