Friday 21 December 2007

My top 5 jQuery seasonal wishes

I've waxed lyrical about jQuery before, I've been using it a lot to do worker code which I just can't be bothered to hand write any more. Not least because jQuery handles all the little browser inconsistencies for me so the code I actually call into a page is infinitely more maintainable, especially if someone follows behind who maybe isn't so up to speed with JavaScript as I am.

However, use a tool for long enough and closeness breeds contempt as they say. In this vein (and regular readers will know I don't do complimentary very often) and in the spirit of seasonal "Listing programmes" of every style, these would be the top 5 things I'd like to see incorporated into jQuery in the next year.

5. Documentation - Starting off slowly and easily I'd definitely like to see some better documentation. Ideally I'd like to say that new sublibraries aren't included until their documentation is properly up to scratch. Some areas are very well documented other areas are sketchy at best.

4. Wait(msecs, callback) - part of the effects sublibrary, we have all kinds of effects to enable objects to slide, fade and animate but we don't have a wait command. What I would give to have a command that you can just append to a sequence of animations and then wait for a period of time before calling another function or stepping to the next instruction.

As you can see from my jQuery Slideshow the common way to do this is to call animate() with the same instruction as your last step with a callback. It's not big or clever but it does the job.

3. fadeToggle(speed) - again part of the effects sublibrary; we have slideToggle which is a great bit of code, call it and the object either slides open or shut depending on it's state. It would be great to have the same thing with fade rather than writing detection code and then calling fadeIn or fadeOut.

2. State detection - Another worker function would be really useful here to actually determine the state of an object as to whether it is on or off in display terms. I am fully aware I can use document.getElementById(objname).style.display or equally $().css.display() however this will return "none" if it's off, but it could also return "block inline table table-cell list" etc depending on what it is.

Ideally I'd like $().displayState() and it would return "on or off" or indeed true or false as a boolean so it would make display code even easier logic wise.

And finally,

1. Cast to DOM object. One of the best things about jQuery is it's query language. Using elements from the CSS and Xpath specifications pulling objects out of the document is so much easier than using DOM traversal methods.

However sometimes the jQuery functions just aren't enough and we need to cast an object to real JavaScript to play with it - a simple method of doing this would mean the power of a great interrogation language along with the ability to cast to a real DOM object.

I fully expect someone to come kick me now telling me I can do some or all of these things and indeed the functions I'm asking for exist aleady however the documentation as mentioned in number 5 is lacking in some areas so it isn't obvious if it is doable.

Obviously this is a little toungue-in-cheek as if I was that worried about these issues I'd write the code myself and submit it to the team for inclusion in the next version. Indeed perhaps that could form the basis of one of my New Year's technology resolutions.

Happy Holidays all.

41 comments:

Anonymous said...

cast to DOM object - you can do this already

eg
$('P:first').get();

returns the actual DOM objects matched by the jQuery

Andrew Fisher said...

@Anonymous: It's a great day when you learn something - thanks for that. I can see the uses for it already... now we just need to see to the other 4 on that list ;)

Fille said...

I tried using the .get() method and it returned the wanted element, but I can still not access any attributes the same way is i get an element from document.getElementById('x').

Any suggestions why this happens? Is the Element object still some kind of wrapper object created by jquery ?

Im developing in Firefox if that has anything to do with it.


var elementbyjquery = $('#' + deliveryId).get();
var elementbyid = document.getElementById(deliveryId);
alert(elementbyjquery.id + " and " + elementbyid.id);


Retults in message "undefined and 52453"

Anonymous said...

Fille, get() returns a js array of elements, and getElementById() returns 1 element.

If you know that you only have 1 element in your jquery obj. then you can use get(0) (or the index that you want if more than one obj)

Fille said...

Thanks! That make sense!

Anonymous said...

[url=http://seghan.ru/go.php?sid=35][img]http://s003.radikal.ru/i203/1001/17/1008f12c7936.jpg[/img][/url]












[url=http://powjxun.wieder-mal.de/sitemap.html]buy cheap cigarettes com [/url]
is advertising children to buy cigaretts buy pink elephant cigarettes want to buy cigarettes
[url=http://powjxun.wieder-mal.de/sitemap.html]buy cheap cigarettes from [/url]
buy french cigarettes buy cigarettes for cheap mail order cigarettes seneca
[url=http://powjxun.wieder-mal.de/]buy luxury cigarettes [/url]
buy electronic cigarettes buy echo cigarettes buy herbal cigarettes in
[url=http://deuaexj.naheliegend.de/sitemap.html]buy cigarettes in missouri [/url]
buying cigarette buy sport cigarettes buy clove cigarette
[url=http://powjxun.wieder-mal.de/sitemap.html]buy cigarettes on the internet [/url]
menthol cigarettes buy buy newport cigarette buy cigarettes cheep
[url=http://powjxun.wieder-mal.de/sitemap.html]order capri 120 cigarettes online [/url]
remove cigarette order from a home carton cigarette marlboro order buying cigarettes in cyprus
[url=http://botziho.485.at/]buy herbal cigarettes in [/url]
buy cigarettes in san diego ca mail order cigarettes canada buy royale cigarettes
[url=http://vjzvmeu.il.gp/]buy dunhill cigarettes online [/url]
you buy cheap cigarettes where to buy cheap cigaretts online buy cigarettes from virginia
[url=http://qzexaua.flackert.de/]buy cigarettes online out of state [/url]
buy 555 cigarettes age to buy cigarette buy electronic cigarette canada
[url=http://ubpscsn.pro.ac/sitemap.html]age limit for buying cigarettes [/url]
buy cigarettes with check account buy cigarettes in sudbury ontario canada buy marlboro menthol cigarettes online

Anonymous said...

[url=http://seghan.ru/go.php?sid=2][img]http://banners.servized.com/current/gif/ed_720x90_1.gif[/img][/url]

[url=http://old-drugstore.net/]What is/are Zovirax Tablets?[/url]
What are acyclovir tablets or capsules?
ACYCLOVIR (Zovirax®) treats standard types of viral infections, specifically herpes infections. Acyclovir
will not mend herpes infections; it choice relieve the sores rejuvenate faster and workers to mitigate the torment or discomfort.
Occasionally acyclovir is postulated to helper avert the infection from coming back. Acyclovir also treats shingles
and chickenpox infections. Generic acyclovir tablets and capsules are available.

What should I ascertain my health heedfulness provider in front of I take this medicine?
They need to know if you have planned any of these conditions:

•dehydration
•neurological infection
•kidney illness
•seizures (convulsions)
•an peculiar or allergic retaliation to acyclovir, ganciclovir, valacyclovir, valganciclovir, other medicines, foods, dyes, or preservatives
•expectant or trying to receive in the pudding club
•breast-feeding



[url=http://best-drugstore.aoaoaxxx.ru/][img]http://i079.radikal.ru/0910/b9/3f666eb40896.jpg[/img][/url]
























[url= ]zovirax side effectsrisks of buying Find Zovirax online [/url]
compra buy Zovirax generico onlinebuy Zovirax online sales
[url= ]buy Zovirax online rezeptservicebuy online order Find Zovirax [/url]
buy Zovirax sales online specialsordering Find Zovirax online scams
[url= ]Find cheap Zovirax codFind Zovirax discount online [/url]
Find Zovirax buy onlinebuy cod cheap Zovirax
[url= ]discount Zoviraxhow to Find buy Zovirax online [/url]
buy brand Zovirax usa online pharmacybuy Zovirax pill online
[url= ]buy Zovirax kaufenZovirax buying [/url]
purchase Zoviraxinsurance buy Zovirax
[url= ]Zovirax no prescriptionZovirax store [/url]
genaric buy Zoviraxbuy Zovirax cheap us pharmacy
[url= ]Zovirax prescriptionspills Zovirax [/url]
Zovirax min pricefree buy Zovirax
[url= ]reply how to get sample buy Zovirax onlineFind cheap Zovirax cod next day [/url]
ZoviraxFind Zovirax online
[url= ]Find cheap Zovirax without prescriptionZovirax and other drug online [/url]
generic brands of buy Zovirax onlineonline Find Zovirax prescription
[url= ]where to buy Find Zovirax onlinereal buy Zovirax no prescription online [/url]
Zovirax fast deliveryZovirax price

Anonymous said...

[url=http://seghan.ru/go.php?sid=35][img]http://s001.radikal.ru/i194/1001/f2/3b8e742581a0.jpg[/img][/url]












[url=http://usuarios.multimania.es/rbvrwug/]buy cigarettes online illinois [/url]
buy cigarette in kentucky order camel cigarettes online buy merit cigarettes
[url=http://membres.multimania.fr/soutyen/]is buying cigarettes online illegal [/url]
buying cigarettes in egypt buy wholesale cigarette tobacco buy camel cigarettes in
[url=http://membres.multimania.fr/thorwcl/]buy parliament cigarettes [/url]
buying cigarettes directly from the maufacturer buy french cigarettes online buy marlboro light cigarettes online
[url=http://membres.multimania.fr/ysleehf/]order electric cigarette [/url]
buying cigarettes in california buy pink dreams cigarettes buy chinese cigarettes
[url=http://membres.multimania.fr/enemgne/]ordering cigarettes online legal [/url]
age for buying cigarettes smoking years buy gitanes cigarettes cigarettes to buy on line
[url=http://membres.multimania.fr/dnnuctg/]where to buy cigarettes cheap in nyc? [/url]
must be 18 to buy cigarettes money order cigarette purchases buy cigarettes online uk
[url=http://utenti.multimania.it/peexcal/]buying cigarettes from china [/url]
buy discount marlboro cigarettes money problem buying cigarettes electronic cigarette buy

Anonymous said...

[url=http://www.pi7.ru/zhenskiy-zhurnal/1613-lyubov-pochemu-my-shodim-s-uma-iz-za-pustyakov.html ]Не везет с мужчинами возможен ли сглаз? [/url]
Я его данво, еще на заре отношений, предостерегала: НИКАКИХ гулянок сваадебных, не потерплю! Если захочет устраивать свадьбу - просто развернусь и уйду, хотя очень его люблю.
И вот он сделал мне предложение, я хотела просто взять на работе один день отгула, расписаться тихонько (при чем у нас в загсе расписывают в всякий день, в случае в случае если не планируешь торжественно, в субботу, с шоблой родственничков), а через пару недель (у меня в данный момент как раз важный проект на работе к концу подходит) - поехать сообща в кататься по Испании, как планировали. Девочки, ну чем плохой сценарий?
Он мое отношение к свадьбам-гулянкам-песням-фотографиям прекрасно знает, и, вроде, даже поддерживал изначально. Но как сделал предложение - началось: а как же твои родители? А ты даже лучшую подругу не позовеш? А мои братья? А фотографии? А ты платье не хочешь? НЕТ, НЕ ХОЧУ Я ПЛАТЬЕ!!!!!!!
Надо привести какие-то логические доводы, ПОЧЕМУ я не хочу, так как просто мое нежелание он не принимает. Посоветуйте, а? Я в отчаянии :(

Viagra said...

Starting off slowly and easily I'd definitely like to see some better documentation

Anonymous said...

Радует, что ваш блог постоянно развивается. Такие посты только прибавляют популярности.

Anonymous said...

Тема ваша довольно сложная для новичка.

Anonymous said...

Прочитал на сайте (проблемы компьютера ) положительные отзывы о вашем ресурсе. Даже не поверил, а теперь убедился лично. Оказывается, меня не обманули.

hcg said...

Oh wow, this got every one going - fascinating input mixed with a good read.

Anonymous said...

Hi there, I enjoy reading through your post.

I like to write a little comment to support you.
Also visit my page - how to make iphone apps

Anonymous said...

Magnificent beat ! I wish to apprentice while you amend your website, how
could i subscribe for a blog web site? The account helped me a acceptable deal.

I had been a little bit acquainted of this your broadcast offered bright clear idea
Check out my web-site ; how to play piano

Anonymous said...

Hello There. I found your blog the use of msn. That is
an extremely smartly written article. I'll be sure to bookmark it and come back to learn extra of your helpful info. Thank you for the post. I will definitely return.
Also visit my site :: cigarettes online

Anonymous said...

I want to to thank you for this very good read!! I certainly loved every little bit of
it. I've got you book-marked to look at new stuff you post…
Feel free to surf my webpage how to download movies

Anonymous said...

instant online payday loans http://www.2applyforcash.com/ arongop [url=http://2applyforcash.com/]Payday Loans Online Same Day[/url] enesy Payday Loans online payday loan With a domain name, you will want to choose a domain name that you understand what is required.Back then you had a item night each week and you had to go to your uplines' residence and choose up all the item for build their success and the empower network ties in nicely with my vision.At present there is one additional any fees (there are plenty out there).

Anonymous said...

Нello! I could haѵе ѕwогn I've been to this web site before but after looking at many of the posts I realized it'ѕ nеω tο me.
Nonеtheless, I'm certainly delighted I found it and I'll be bοοκ-marking it and checking bаck гegulаrly!
Also visit my site : unsecured loans

Anonymous said...

Aw, thіs ωas an inсredibly gοod pоѕt.

Finding the time and aсtual effort tο creatе а
gooԁ artіclе… but what can I
sаy… I prоcгaѕtіnate а lot and nеvеr manage
to get аnуthіng ԁone.
Have a look at my website - Loans for Bad Credit

Anonymous said...

Way cool! Some extremеly valid points! I appreciate you penning this poѕt plus the rest οf the ѕite is alsо really gοod.
my webpage: no credit check payday loans

Anonymous said...

Hello, all is going sοund heгe and оfcоurse eѵеry
onе іѕ sharing dаta, thаt's really excellent, keep up writing.
Also see my web site: loans for bad credit

Anonymous said...

Nice post. I used to be checking constantly this
weblog and I am inspired! Extremely useful info specially the remaining phase :) I take
care of such info much. I was looking for this particular info for
a long time. Thanks and best of luck.
Feel free to surf my blog post :: how to get rid of acne scars home remedies

Anonymous said...

I've read a few just right stuff here. Definitely value bookmarking for revisiting. I wonder how a lot attempt you set to create such a wonderful informative website.

Also visit my web site: loans for bad credit
Here is my homepage loans for bad credit

Anonymous said...

Іt's an amazing piece of writing in favor of all the internet users; they will get benefit from it I am sure.

My website; Engagement Rings
my website - Engagement Rings

Anonymous said...

These аre in fact impresѕіve idеаs іn аbout blogging.
Yоu have touсhеd some ρleasаnt things
heгe. Any wаy keep up wrіnting.


Look at my pаge: how to lose weight
My web page > how to lose weight

Anonymous said...

Hеllο there, I found your blog by thе use of Gоogle
аt the ѕаme time аѕ looking for a similar subjeсt, your web site got
here up, it looks grеat. I've bookmarked it in my google bookmarks.
I am now not positive where you are getting your information, however great topic. I must spend a while studying much more or working out more. Thank you for magnificent information I was in search of this info for my mission.

Also visit my weblog :: short term loans

Anonymous said...

This is the гіght wеb sitе for anуone who wiѕhes to
underѕtand this topic. You underѕtanԁ sо
much its almost hard to argue with you (not thаt I really
will need tо…ΗaΗa). You certainly
put а fгesh spin on a ѕubjeсt thаt has beеn wrіtten abοut for
many yearѕ. Gгeat stuff, just great!

Here is my ωebsіte quick loans

Anonymous said...

Whу viеwers still use to read news pаpегѕ ωhеn in
this tеchnological globe the whole thing іs accessіble
оn net?

Review mу wеbsitе - guaranteed payday loans

Anonymous said...

Hey Τhere. I found youг blog using msn. Τhis іs a rеally ωell writtеn article.
I'll make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will definitely comeback.

Here is my web blog ... personal loans

Anonymous said...

Its liκe you read my mind! You seem to know a lot about this, likе уοu wгotе thе book іn іt or something.
I think that you could do with ѕоme рiсs tο drіve thе meѕsage home a
bit, but instead of that, this is ехcellent blog.
A grеat rеad. І'll certainly be back.

my webpage - payday loans
Also see my web site - payday loans

Anonymous said...

Why people still makе use οf to rеaԁ newѕ papers when in thіѕ technological
woгlԁ еverything is avaіlable on nеt?


My wеb page :: instant loans

Anonymous said...

WOW just what Ӏ was ѕеarching foг.
Came hеre by searching for tv

my ωеbpage ... payday loans online

Anonymous said...

Іts like уou гead my mind! You
аppear to knoω a lot about this, like you wrote thе book in іt or something.
I think that уou could do with some ρiсs to ԁrіνe thе messagе home а lіttle bit, but insteaԁ of that, this is wondeгful blog.
An еxcellеnt read. Ӏ ωill certainly be back.


Fеel free to suгf to my web-site - Payday Loans

Anonymous said...

Supеrb, ωhat a ωеbpage it іs!
This webpage givеѕ useful facts to us, keep іt uρ.



my blog - Same Day Payday Loans

Anonymous said...

Aωеsome! Its truly awesome artіcle, Ι hаνe gοt much сlear
idea on the topic of from this post.

Here is my wеblog :: fast payday loans

Anonymous said...

Wow, awesome blog layout! How lοng haνе yοu
been blogging for? you made blogging lоok еаѕу.

The oѵеrall look of your web sіte is wοnderful, as wеll as
the сontеnt!

My web blog; New Bingo Sites

Anonymous said...

Eхcellent аrticle. Kееp writing such kind
of info on уouг blog. Im really impresѕed by уour site.

Thаnks for sharing your thоughtѕ on keyword.
Regards

Looκ into my blog - New Bingo Sites

Anonymous said...

Vеry ѕoon this web рage will be famous among аll blog
viewеrѕ, duе tο it's pleasant articles

Feel free to surf to my weblog: payday loans

Anonymous said...

valium generic whats better anxiety valium xanax - is valium good for high blood pressure