`html` isn't the root of the document #162

fb55 opened this Issue Feb 15, 2013 · 5 comments


None yet

3 participants

fb55 commented Feb 15, 2013

fb55/css-select#8 should be handled here. The issue is that selectors such as * html match elements. This won't be fixed in CSSselect, so I'm moving it here.

@fb55 fb55 referenced this issue in fb55/css-select Feb 15, 2013

"* html" incorrectly matches elements #8


I'm running into this issue. I'm trying to write code that's portable between jQuery and cheerio; and it's becoming difficult, because I can't find a portable and performant way to acquire the root element. Cheerio wants $.root(), whereas jQuery wants $(':root') or $(':eq(0)').

fb55 commented Apr 8, 2013

@elliottcable How about $("html")? Some documents won't have it, but that shouldn't be too bad.


@fb55 that's what I'm doing right now, but I tend to want to write “correct” code. What I'm truly looking for here is to acquire the root of any document it may be processing, and that seems to be too hard-coded for my tastes. Make sense?

Either way, it's something worth fixing, even if there's a passable way around it like that.


Resolved via commit 7c07fac

fb55 commented Apr 8, 2014

This actually isn't fixed. CSSselect's :root, as well as .root(), don't behave as expected.

@fb55 fb55 reopened this Apr 8, 2014
@fb55 fb55 added the Bug label Apr 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment