Friday, July 24, 2009

Y.get() != new Element()

While trying to use YUI 3.0, I was attracted to try out the YUI Node feature with the following code

$ele = Y.get('foo');

I was working out some race condition problems, and was hoping the waiting feature (where YUI will wait for the element to be in a ready state) would solve some problems for me.

What I had forgot was that Y.get is not the standard dollar function ( $('foo'), $('#foo'), etc ). This poses some real problems for me. I didn't really used the Dom.get methods, and probably for the same reasons, as I use both YUI and prototype together mostly.

But now I want to integrate the really nice features of YUI 3 into my code, and try and break away from my prototype "crutch". However, since I do use other 3rd party libraries for various things, most of them rely on straight up Dom elements being passed to them.

I hate to say it, but I have found something in YUI that just does not sit well with me.

The code still seemed to work with

Y.get('foo');
$ele = $('foo');

But I can't say for sure, and this seems pretty hacky?

No comments: