It's not a bug in :empty. I just changed the documentation to this:

        Matches all elements that have no children (including text nodes).

Then, for the "demo" tab, I changed it to this:

Finds all elements that are empty - they don't have child elements or text.

Does that help clarify it? If not, feel free to edit it directly in the wiki or reply to this with a suggestion for revision.

Thanks,

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Dec 3, 2007, at 5:59 AM, Christoph Roeder wrote:


Hello,

I think the :empty pseudo-class has a bug, the docs are wrong or I
misunderstood the docs.

The Problem is, that :empty only matches elements when they really
have no children, incl. textnodes with whitespaces or newlines.

http://docs.jquery.com/Selectors/empty
Matches all elements that are empty, be it elements or text.

Example:
~~~~~~~
$("#test").is(":empty")
-> returns: [ #test ], instead of an empty array


<div id="test">

</div>

Reply via email to