           (fn ignore-anchor-click
             [e]
             ;; Returns the next matching anchestor of event target
-            (when-let [el (.closest (.-target e) "a")]
+            (when-let [el (closest-by-tag (.-target e) "a")]
               (let [uri (.parse Uri (.-href el))]
                 (when (and (or (and (not (.hasScheme uri)) (not (.hasDomain uri)))
                                (= current-domain (.getDomain uri)))

    (if path
      (str "#" path))))

(defrecord Html5History [on-navigate router listen-key click-listen-key]
  History
  (-init [this]

                           (= 0 (.-button e))
                           ;; isContentEditable property is inherited from parents,
                           ;; so if the anchor is inside contenteditable div, the property will be true.
                           (not (.-isContentEditable el))
                           (reitit/match-by-path router (.getPath uri)))
                  (.preventDefault e)
                  (let [path (str (.getPath uri)
