Updated YUI3 for YUI2


For those of you who are using my YUI 3 for YUI 2 emulation code, I want to share with you the latest, and perhaps final version. This version is very similar to what we are now using on Mint.com, where I have been successfully swapping back and forth between the mock YUI 3 and the real YUI 3.

http://yui-ext-mvc.googlecode.com/svn/trunk/assets/js/yahoo-ext/yui3foryui2.js

Notes

  • Y.Base.create has been added
  • use YUI.add instead of YUI().add
  • Y.NodeList is now supported
  • Y.Event.attach and Y.Event.detach emulated
  • window resize event supported
  • the Y.mix function is fully emulated

There is definitely more, but the above is a good list of the major improvements.

Adding Find() to NodeList in YUI3


In YUI 3, when searching an array for a value, you have to include the collection module, as the Y.Array.find() function is not built into Y.Array. This is a little annoying, because 9 out of 10 times, I include the collection module, it is just for the Y.Array.find() function. Additionally, because the function isn't built into the core library, it is not used or added to the core features, like NodeList. Yet, I believe having a find() function on NodeList is very useful and this article provides a simply way to augment NodeList.

continue reading article…

Mocking YUI 3 in YUI 2


At Mint.com we have wanted for some time to upgrade to YUI 3. However, since YUI 3 is not backwards compatible with YUI 2, it is hard to justify taking the time to port a large codebase. To alleviate the cost of upgrading, we have decided on a two step approach. During the first phase we will convert our YUI 2 code to use YUI 3 syntax, then in the second phase when we switch to YUI 3, many parts of the code should work right away.

continue reading article…

IE 8 Compatibility Issue with YUI 2 Selector Component


I realized recently, in my work on Mint.com, that the YAHOO.util.Selector.query function does not work properly in IE 8 compatibility mode when performing a search against the class and for attributes. The issue is that previous versions of IE defined these attributes names as className and htmlFor, while IE 8 changed them to follow the standard. And a faulty if statement in the selector component does not properly use the legacy names when developers apply the X-UA-Compatible META tag to set compatibility modes.

continue reading article…

Augmenting YUI3 Module Objects


In YUI 2 augmenting a library class is as simple as appending functions to the static object or modifying the prototype of a non-static object. Augmenting objects in YUI 3 is almost as easy, differing only in the augmentation having to be applied inside of a YUI().add() function. Although, augmenting objects is not difficult, it feels complicated until you become used to the YUI 3 way of coding. This article will cover how to augment the objects in the YUI 3 library.

continue reading article…