diff --git a/deps.edn b/deps.edn index 14472e6..7303e43 100644 --- a/deps.edn +++ b/deps.edn @@ -1,7 +1,7 @@ {:paths ["src/clj" "src/cljc" "src/cljs"] :deps {org.clojure/clojure {:mvn/version "1.11.1"} - org.jsoup/jsoup {:mvn/version "1.14.3"}} ;hold back jsoup upgrade due to graal incompatibility + org.jsoup/jsoup {:mvn/version "1.18.3"}} ;hold back jsoup upgrade due to graal incompatibility :aliases {:test {:extra-paths ["test/cljc"]} :cljs {:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.60"}}} diff --git a/project.clj b/project.clj index e874df8..6cb641b 100644 --- a/project.clj +++ b/project.clj @@ -11,7 +11,7 @@ :dependencies [[org.clojure/clojure "1.11.1"] [org.clojure/clojurescript "1.11.60" :scope "provided"] - [org.jsoup/jsoup "1.15.2"]] + [org.jsoup/jsoup "1.18.3"]] :source-paths ["src/clj" "src/cljc" "src/cljs"] diff --git a/src/clj/hickory/core.clj b/src/clj/hickory/core.clj index 3212d4e..0814512 100644 --- a/src/clj/hickory/core.clj +++ b/src/clj/hickory/core.clj @@ -7,6 +7,8 @@ DocumentType Element TextNode XmlDeclaration] [org.jsoup.parser Tag Parser])) +(set! *warn-on-reflection* true) + (defn- end-or-recur [as-fn loc data & [skip-child?]] (let [new-loc (-> loc (zip/replace data) zip/next (cond-> skip-child? zip/next))] (if (zip/end? new-loc) @@ -68,9 +70,10 @@ DocumentType (as-hiccup ([this] (trampoline as-hiccup this (hzip/hiccup-zip this))) - ([this loc] (end-or-recur as-hiccup loc (utils/render-doctype (.attr this "name") - (.attr this "publicid") - (.attr this "systemid"))))) + ([this loc] + (end-or-recur as-hiccup loc (utils/render-doctype (.name this) + (.publicId this) + (.systemId this))))) Element (as-hiccup ([this] (trampoline as-hiccup this (hzip/hiccup-zip this))) @@ -141,12 +144,16 @@ ([this] (trampoline as-hickory this (hzip/hickory-zip this))) ([this loc] (end-or-recur as-hickory loc (.getWholeText this))))) +(set! *warn-on-reflection* false) + (defn parse "Parse an entire HTML document into a DOM structure that can be used as input to as-hiccup or as-hickory." [s] (Jsoup/parse s)) +(set! *warn-on-reflection* true) + (defn parse-fragment "Parse an HTML fragment (some group of tags that might be at home somewhere in the tag hierarchy under ) into a list of DOM elements that can