enlive icon indicating copy to clipboard operation
enlive copied to clipboard

void selector is whitespace-sensitive

Open gtebbutt opened this issue 11 years ago • 2 comments

Possibly expected behaviour, but it seemed worth mentioning: the void selector currently excludes nodes which contain only whitespace (where a CSS :empty selector would match).

[[:div#menu void]]

matches:

<div id="menu"></div>

but not:

    <div id="menu">
    </div>

The fix is very simple:

(def void (pred #(empty? (remove empty? (map clojure.string/trim (:content %))))))

gtebbutt avatar Feb 04 '14 13:02 gtebbutt

Good point! SGML states that these two snippets are equivalent. Nevertheless your fix may break existing programs that coped with this "feature", so we'll consider it for a major version. Thankies!

fdserr avatar Jul 10 '15 02:07 fdserr

What about adding a dedicated whitespace ou whitespace-only selector? (and cross document the new selector and void)

cgrand avatar Sep 02 '15 12:09 cgrand