Zach’s ugly mug (his face)

Zach Leatherman

8 Things the YUI Library Needs to Win Me Back

24 Jul 2007 Zach Leatherman 5 min read

Warning

This article is old and may contain information that is outdated, irrelevant, or—dare I say it—no longer accurate. Read with care!

I’ve been cheating on my first love. When I first started seriously JavaScripting and not CopyPasteScripting, my first framework was the Yahoo User Interface Library. I was just beginning to realize the power of a JavaScript framework, but at the time I also thought that the Dom was an actor in Hollywood’s The Cannonball Run. Hey, everyone’s gotta get their start somewhere.

Dom

But now I’ve been learning advanced JavaScripting techniques. I’m not a bad person… but I’ve been experimenting with new frameworks while YUI was out of town on business. And ever since I’ve been going behind YUI’s back, I’ve been feeling guilty because it feels so good to cheat. I am experiencing all these new JavaScript programming ideas that I’ve never felt before. But at the same time, I feel regret. We are still friends and I still hang out with YUI often, but I know she wants me back full time. I am open to that possibility, but first I want her to change a few things.

  1. CSS Selector Engine: All the major frameworks are doing it. cssQuery started it (I think?). jQuery was built on it. Ext revolutionized it. Even Mootools, Prototype, and Dojo have their own implementations. Where is my baby?
  2. An official community driven plug-in system: No, I’m not talking about yazaar.org, although it is a good idea. I want something official, to give credibility to plug-in contributors. You can still have control of your main components, but why not open it up?
  3. An iterator? I’m of course talking about the each() function in jQuery, which operates on both Array’s and Object’s without discretion.
  4. Easier Databinding. Why do I have to program my own logic to iterate through the XML returned in my Ajax call? At least something that allows me to query an XML document easier (see CSS Selector Engine)
  5. I know I probably shouldn’t be talking about the component controls, since those are really ancillary to the framework, but a DataTable that supports both horizontal and vertical scrolling while always showing the headers!
  6. Form Validation Utility, or at least a few convenience functions to deal with forms, especially radios and checkboxes.
  7. Of course, I would have said easier operations on HTMLElement’s, but the new YUI Element (Beta) Utility is doing wonders there. But how about some sort of DOM Creation class? Of course, I couldn’t mention this without plugging the DOM Creation class I built for YUI called DOMDom.
  8. Client Browser Detection. While I would never encourage sniffing glue, sometimes sniffing the browser is unavoidable. This would be a nice convenience when porting plug-in code from other libraries as well.

Some might say Chaining, one of jQuery’s biggest features or a la Dustin Diaz’s extension to YUI called DED|Chain. But to be quite honest, that doesn’t bother me too much. Chaining might increase convenience a little bit, but perhaps at the sacrifice of a small amount of code readability. Either way, it isn’t necessary to me.

So, there you have it. YUI, you will always have a piece of my heart. But for now, you only have a piece. Do you want me back or not?

I’ll go over what I’m looking for in the new library I’ve been eyeing in a future article I’m tentatively calling “X Things jQuery Needs to Win Me Over.” Stay tuned.

7 Comments

➡ Load Disqus to Leave a Comment ⬅

Zach,

We're glad to have a piece of your heart...and we're also grateful for the constructive feedback. We're on the same page with you on almost all of these points, and we're working hard to win you over completely. YUI 2.3.0 is almost here, and she's better-looking than ever. She'll even cross number 8 off your list: The YAHOO Global Object now has browser detection (as of 2.3.0). And there's some other good stuff in there that didn't make your list (but that doesn't mean you won't like it!).

Thanks again for keeping us focused on what your needs are.

Regards,
Eric
YUI Team

Zach Leatherman

25 Jul 2007 at 10:55PM

Hey Eric, Thanks for the response.

It always feels like my birthday when a JavaScript framework comes out with a new version. I'm looking forward to the release and reading the specifics! I know a lot of people think that you can get away without doing any browser detection, but those people certainly aren't coding in the real world.

Looking forward to hearing about #'s 1-7 as well :) Sorry I'm such a hard developer to please.

Zach

I have to admit, The Ext lib has stolen me away for exactly the same reasons. I'd like to see YUI return to its complete glory, since it was the original inspiration behind Ext. I'm definitely interested in a "DomBuilder" class of some sort, since that's a lot of what our work needs to do. I'd say a great high level class to building HTML would work wonders. Programmatically and via templates would be very useful.

My first time using a javascript library as opposed to cobbling scripts together. It's hard to sort the wheat from the chaff but I found a few comparison articles and decided to give YUI a go as it allegedly had good event handling and DOM manipulation modules, which cover most of what I need for this project. So I'm underway and all is going swimmingly. Then I remember I also need fomr validation.

My search has led me here and it looks like there is no form validation with YUI. I don't suppose by some stroke of luck that form validation has been added since this article? :)

Zach Leatherman

15 Dec 2007 at 12:12AM

Sorry John. Looks like you're out of luck. I've rolled my own form validation scripts from scratch, but they are by no means ready for the light of day.

But the good news is that with the new CSS selectors, it'll be easier than ever to build something to do it.

Just plug in some regexes and you'll be off to the races :) Good luck

Hi,

I found this one and tweaked it to my needs for the short term.

http://blog.jc21.com/2007-0...

cheers

hi jon. the form validation u gave is good but it looks like there is a conflict with YUI RTE(Rich Text Editor) when the setting handleSubmit is true. The form still validates but its still submit the form.

anybody have a hint about this?