擦
display供应商前缀Flexbox将是非常重要的,并显示一个排序(-webkit-box,-moz-box,-ms-flexbox,-webkit-flex,flex)-moz-box出去-moz-flex(-webkit-box,-webkit-flex,-moz-flex,-ms-flexbox,flex)box,其中的其他两页甚至没有提到(-webkit-box,-moz-box,box,-webkit-flex,-moz-flex,-ms-flexbox,flex)问题
大部分情况下,我与 clojure.spec 相处得很好。然而,在处理的过程中,我遇到了一个无法解决的问题unform。这是一个让我们行动起来的 Hiccup 的宽松规范:
(require '[clojure.spec :as s])
(s/def ::hiccup
(s/and
vector?
(s/cat
:name keyword?
:attributes (s/? map?)
:contents (s/* ::contents))))
(s/def ::contents
(s/or
:element-seq (s/* ::hiccup)
:element ::hiccup
:text string?))
Run Code Online (Sandbox Code Playgroud)
现在,在我们得意忘形之前,让我们看看它是否适用于小型路过的情况。
(def example [:div])
(->> example
(s/conform ::hiccup))
;;=> {:name :h1}
Run Code Online (Sandbox Code Playgroud)
奇迹般有效。但我们可以撤销我们的一致性吗?
(->> example
(s/conform ::hiccup)
(s/unform ::hiccup))
;;=> (:div)
Run Code Online (Sandbox Code Playgroud)
嗯,那应该是一个向量。我错过了什么吗?让我们看看规范对此有什么规定。
(->> example
(s/conform ::hiccup)
(s/unform ::hiccup)
(s/explain ::hiccup))
;; val: (:div) fails spec: :user/hiccup predicate: vector?
;;=> nil
Run Code Online (Sandbox Code Playgroud)
确实,它失败了。所以问题是:我怎样才能让它正常工作?