开发者

The footprint of complex jquery and javascript in a web application?

I am designing a website utilizing CI and jquery.

I have today been working on a registration script.

I was playing with jquery, and realized it could do a lot of cool stuff.

For example, I want the script to check username availability for example on the fly. Then i want it to check that the users password is secure on the fly..

I wrote the jquery for the former, then attempted to to i开发者_JAVA技巧mplement the functionality for the password.

The thing is.. as they both use different models, and return different results, and return different text responses, it simply seemed easy to copy the code, and simply change the variables, file calls, and text for each.

It works perfectly.. I have around 70 lines of code ... a lot of it very repetitive. I was just wondering what the footprint of jquery within an app is.

On top of this.. Im doing stuff, then realizing i can do something else pretty cool.. as such I am doing things with jquery which i dont need, but am doing simply because they are cool..

Could someone put into a little perspective the footprint of jquery, and to what extent i should use it 'just because its cool'?


Well considering jQuery is Javascript (as it was written in javascript) than it isn't going away any time soon. But you have to weigh the pros and cons of what exactly you are trying to accomplish. jQuery doesn't have to be the entire solution to a problem domain. What it can be is part of the solution to a problem.

What I mean by this is jQuery is a nice small robust library that helps solve particular issues, it will never replace server side processing as it works on the client side. What it helps with is the user experience. If the "cool" things you have done have improved your UI then +1 to ya. If you're just making things animate and disappear because it's cool BUT at the same time affects the UI in a negative manner get rid of it. I'd rather see a message div stay on my screen rather then see it flicker and then come fully into effect. Sure the flickering is cool but you have to play the role of the end user and weigh the pros and cons of the "cool" things.

Good luck.


The minimum footprint I guess will be the size of the included jquery library. The total footprint of your application using jquery vs handcoding plain javascript will probably be negligible to achieve the same things mentioned, nevermind solving cross browser issues and reduced development time. You really dont need to worry about this.


Apart from being "cool" it also addresses a very important issue - cross browser compatibility!

Whether the footprint is low or high is subjective but it certainly is worth the additional hit. Also, its a one time download as browsers will cache it. If you use google or MS cdn, chances are that browsers already have downloaded that (for some other site).

I would recommend it, but then, you need to profile your app and see if fits your needs or not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜