On Sep 17, 12:46 pm, David Duymelinck <[EMAIL PROTECTED]> wrote: > As for your example couldn't you do something like > > var c = a+b; $("...:lt(c)"); > > Using a method you would have to do that so you save some bytes.
Absolutely, but it's still inelegant, IMO. i find $("...").lt(a+b) to be clearer. Part of my dislike of the stringified selectors, as opposed to functional ones, is based upon lots of experience writing file parsers (primarily in C++, e.g. the file format parsers for http://s11n.net). Outputing data is easy, but parsing data is amazingly problematic and error-prone. So when i see mini-languages encoded in strings, my gut instinctively wrenches (probably more out of sympathy for the parser maintainer than any other reason). > I don't care if i have to use a selector or a method, i agree with you > methods come more natural for long time programmers, i'm just trying to > understand why some functionalty decisions are made. i think the main reason lt/gt were removed was "because you can do the same thing with slice()". John Resig said in a post a week or so ago that they were also removed because "they did only one thing, and didn't do it terribly well" (or something to that effect). Fair enough, but then i would prefer that x.lt(n) be kept and implemented in terms of $( ":lt(n)",x), or vice versa. :)