I am trying to use Sizzle to do matches using a documentFragment
object in IE8 (in IE7 back-compat mode). However, regardless of the
selector expression I always get an empty set. I starting looking at
the sizzle.js file to see what the matter is and right there at the
top of the file (around line 20) is this code fragment:
That's intentional. Browsers don't provide the very basic methods needed to
select elements within a document fragment. For example there is no
getElementsByTagName. Some of the new browsers support querySelectorAll on
fragments, but that's not guaranteed in all browsers.
--John
On Wed, Sep 16, 2009 at 11:51 AM, Sahab Yazdani <sahab.yazd...@gmail.com>wrote:
> I am trying to use Sizzle to do matches using a documentFragment
> object in IE8 (in IE7 back-compat mode). However, regardless of the
> selector expression I always get an empty set. I starting looking at
> the sizzle.js file to see what the matter is and right there at the
> top of the file (around line 20) is this code fragment:
> That's intentional. Browsers don't provide the very basic methods needed to
> select elements within a document fragment. For example there is no
> getElementsByTagName. Some of the new browsers support querySelectorAll on
> fragments, but that's not guaranteed in all browsers.
> --John
> On Wed, Sep 16, 2009 at 11:51 AM, Sahab Yazdani <sahab.yazd...@gmail.com>wrote:
> > Hi All,
> > I am trying to use Sizzle to do matches using a documentFragment
> > object in IE8 (in IE7 back-compat mode). However, regardless of the
> > selector expression I always get an empty set. I starting looking at
> > the sizzle.js file to see what the matter is and right there at the
> > top of the file (around line 20) is this code fragment:
I guess the check could be rewritten to look for querySelectorAll or
getElementsByTag name and still provide the possibility to use
document fragments if you really need it. Why it's important for my
project is that we can get dramatic speed boosts if we can use sizzle
"some times" on document fragments. And document fragments on IE for
example has the getElementsByTagName since it's basically a whole
document clone.
On Sep 16, 5:58 pm, John Resig <jere...@gmail.com> wrote:
> That's intentional. Browsers don't provide the very basic methods needed to
> select elements within a document fragment. For example there is no
> getElementsByTagName. Some of the new browsers support querySelectorAll on
> fragments, but that's not guaranteed in all browsers.
> --John
> On Wed, Sep 16, 2009 at 11:51 AM, Sahab Yazdani <sahab.yazd...@gmail.com>wrote:
> > Hi All,
> > I am trying to use Sizzle to do matches using a documentFragment
> > object in IE8 (in IE7 back-compat mode). However, regardless of the
> > selector expression I always get an empty set. I starting looking at
> > the sizzle.js file to see what the matter is and right there at the
> > top of the file (around line 20) is this code fragment:
I managed to fake getElementsByTagName support for DocumentFraments so
this makes it possible to use the Sizzle engine on DocumentFragments
regardless of browser type or version.
> That's intentional. Browsers don't provide the very basic methods needed to
> select elements within a document fragment. For example there is no
> getElementsByTagName. Some of the new browsers support querySelectorAll on
> fragments, but that's not guaranteed in all browsers.
> --John
> On Wed, Sep 16, 2009 at 11:51 AM, Sahab Yazdani <sahab.yazd...@gmail.com>wrote:
> > Hi All,
> > I am trying to use Sizzle to do matches using a documentFragment
> > object in IE8 (in IE7 back-compat mode). However, regardless of the
> > selector expression I always get an empty set. I starting looking at
> > the sizzle.js file to see what the matter is and right there at the
> > top of the file (around line 20) is this code fragment: