This project is read-only.
Project Description
Linq to jQuery plugin came to support linq to jQuery objects and
proves easy support to jQuery functions.

So... where would I want to use it actually?!?
For example, lets say we got a list of divs, where each one got a certain
data value, and we want the ones with .data('mode') == 'big'
using normal jQuery we would need to do something like this:

$('div').each(function(){
  if($(this).data('mode') == 'big')
    $(this).hide();
}); 

Pretty long for such a simple task no?, so how would we do it with linq?
Simple:

//normal way:
$('div').where().data('mode','big').select().hide();
//or a lambada string way
$('div').where('x=>x.data.mode == "big"').select().hide(); 

Learn
Basic Idea is from linq

//From each div, where height equels 50, select and hide
$.from('div').where().height(50).select().hide(); 

So the basic syntex is:
From SOMETHING where SOMETHING select ACTION
We can also shorten the from like this:

$('div').where().height(50).select().hide(); 

Ok awesome, lets say I want to do more complex stuff
for each object from those objects... do I need to use .each after
the select?, well, you can, but no...

var width = 0;
$('div').where().height(50).select(function(){
  width += $(this).width();
}).hide();

All cool, lets say I want to do everything which is
is bigger then 50 height..

//More Then
$('div').where().mt().height(50).select().hide();
//Less Then
$('div').where().lt().height(50).select().hide();
//More or Equels Then
$('div').where().mt().and().height(50).select().hide();
//Not
$('div').where("not").height(50).select().hide(); 

Ok, Lets say you want something complicated which the where
function doesnt got, for example you want all items which got
opacity which is bigger then .5 AND height is bigger then 50px

$('div').where(function(){
  if($(this).css('opacity')>0.5 && $(this).height() > 50)
    $.addLinq(this); //Following function adds the item into our objects
}).select().hide(); 

Everything seems pretty cool, After you got the basic idea
We can move into the advanced stuff for our linq users
Lambada String!

//Getting all objects which .data('mode') bigger then 50
$('div').where('x => x.data.mode > 50').select().hide(); 

And of course, What about more complex linq functions, does it got them also?
Well, Some of them...

//Takes all the divs where text contains "Water", Reverse there order, Skips the First 5 and then Takes the first 2
$('div').where('x=>x.text.contains=="Water"').reverse().skip(5).take(2).select().hide(); 

And that is basicly it for now!
Note this is still Beta, and please note me for bugs / ideas
Docs still not up yet, soon I would upload them also so you would be able to see all the functions

Last edited Jun 4, 2010 at 8:30 AM by Itayeng, version 9