Amy Groshek Avocation and Vocation

jQuery / YUI : Rosetta Stone Gaps

Placed here for my own reference as it's so dang hard to find things in the YUI documentation. Further, when I do find these methods of Node in the YUI documentation, there are no accompanying examples, and I have to spend 15 minutes verifying that the method works as desired.

For example, compare http://api.jquery.com/index/ with http://yuilibrary.com/yui/docs/api/classes/LazyModelList.html#method_indexOf.

Selection from a Selection

jQuery

var $selection = $('.selector');
var refined = $selection.find('a');

YUI

var $selection = Y.all('.selector');
var refined = $selection.filter('a');

Index of Selected Item

jQuery

var $selection = $('.selector');
var $index = $selection.index('a');

YUI

var $selection = Y.all('.selector');
var refined = $selection.indexOf('a');

 

comments powered by Disqus
comments powered by Disqus