Hi,

This is my first post here and I did try searching for this in the
archives. Please be gentle.

I believe jQuery's :nth-child selector doesn't work inside
GreaseMonkey 0.8.
(At the bottom is a quick GM script to test this.)
Why is this?
Is this a known limitation from working inside GreaseMonkey?
Can anyone recommend a way around this?

Also, why is it that _some_ (definitely not all)  jQuery queries run
*much* slower inside GreaseMonkey, I don't have a quick benchmark test
right now, but I've noticed it often as I was building a pretty
complex GM script that relied heavily in GM, 
http://elzr.com/posts/backbars-on-social-link-sites.
I would run my code outside GM, in Firebug, and things would be
snappy, inside GM, the browser was brought to its knees. I know I'm
being vague but I was wondering if there are some architectural
reasons in GM or jQuery why this would be the case.

Thanks!

-elzr

// ==UserScript==
// @name          Test of nth-child
// @namespace     http://elzr.com
// @description   nth-child doesn't work in jQuery within GreaseMonkey
// @include       http://en.wikipedia.org/*
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
// @author        Eliazar Parra elzr.com
// ==/UserScript==
//
// For detailed info and screenshots see 
http://elzr.com/posts/wikipedia-backbars

$(document).ready(function() {
        console.log($('a:nth-child(1)').length)
});

Reply via email to