I knew that Karl, just seeing if you were paying attention. ;) I totally forgot I was doing that, guess that is what I get when trying to code with very little sleep. Thanks.
On 11/25/07, Karl Swedberg <[EMAIL PROTECTED]> wrote: > > > On Nov 25, 2007, at 9:08 AM, Benjamin Sterling wrote: > > Karl, > That is what I expected get too, just needed to clarify. > > If you just want to select table cells, why not do $('td:contains(Cell)') > > ? > > > > I am doing an article on selectors and selector speeds and was > experimenting on what approach is faster[1] and when I got to this selector, > I would have expected the BODY and HTML be selected also, but since it did > not, I started to second guess myself. > > I have a test page up at > http://benjaminsterling.com/articles/jQuery-%20Select%20what%20you%20want%20-%20part%201.htm > > > and if you hit the "Test 10 toggle" button, you will see that only the > table elements are getting the background color of #FF0 as well as the DIV > that the TABLE is wrapped in, leaving the BODY, and HTML tags alone. So > would you say this is a bug or something we should expect? > > > Nah, I'd say it's doing exactly what your selector is asking it to do. :-) > The "test 10 toggle" button looks for all elements with ":contains('Cell')" > within the context of all elements with class="theDiv". That's why the html > and body tags aren't being included. > from your script: > > $(":contains('Cell')", ".theDiv").css("background", "#ff0"); > > > Try it without the contextual selector, and you'll see that everything > turns yellow: > > $(":contains('Cell')").css("background", "#ff0") > > Cheers, > > Karl > > -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com http://www.benjaminsterling.com