Giter Club home page Giter Club logo

jquery-yui3-rosetta-stone's Introduction

jQuery - YUI3 Rosetta Stone

The jQuery - YUI3 Rosetta Stone is a guide to idioms in YUI3 and jQuery, intended as an aid for developers who are familiar with one library and are interested in using or learning more about the other. It may also be helpful as a general cheat sheet for both libraries.

The Rosetta Stone was originally created by Carlos Bueno, and is now maintained by the YUI team and Paul Irish of the jQuery team.

This is a reference, not an evaluation or comparison of the libraries. If you have an opinion about which one is "better", that's great, but we don't want to hear it.

Contributing

The Rosetta Stone is by no means complete or authoritative, so your contributions, bug reports, and suggestions are more than welcome.

Please report bugs via the GitHub issue tracker. Suggestions are welcome in the form of enhancement tickets or commit comments.

To contribute a patch, please fork the GitHub project, create a topic branch for your change, commit your change to the branch, and then send a GitHub pull request from your branch with a description of the change and why you think we should pick it up.

License

Copyright (c) 2010, Carlos Bueno All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Carlos Bueno nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jquery-yui3-rosetta-stone's People

Contributors

alanning avatar aristus avatar derek avatar homeslicesolutions avatar juandopazo avatar paulirish avatar rgrove avatar sartak avatar stevenbedrick avatar xcatliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jquery-yui3-rosetta-stone's Issues

Include .live() and .delegate()?

It seems like it would be handy to include an example of going between JQuery's .live() and YUI3's node-event-delegate. I'd do it myself, but don't feel like I understand either one well enough to give a definitive example.

Erroneus example for jQuery's `$( ... ).each`

From the actual example:

// jQuery

$('.foo').each(
  function() {
    this.some_method();
  }
);

// YUI

Y.all('.foo').each(
  function() {
    this.some_method();
  }
);

Should be:

$('.foo').each(
  function() {
    $(this).some_method(); // notice the wrapped `this`
  }
);

While this in the traverser in YUI is a Node object, in jQuery is the actual HTMLElement! Not only the example should be edited, but a little note IMO is required.

map() example

YUI has a less cumbersome map feature than the example, that isn't restricted to nodes:

// Convert an array of numbers into an array of strings.
Y.Array.map([1, 2, 3, 4], function (item) {
  return '' + item;
});
// => ['1', '2', '3', '4']

So in the context of the example given, this could be a one-liner:

Y.Array.map(Y.all('a').getDOMNodes(), some_function);

next()

jQuery: Description: Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

YUI: Returns the next matching sibling. Returns the nearest element node sibling if no method provided.

The two next() method will return different node if given selector matches siblings but not the cloest next node.

Replace .bind() by .on()

In this statement, under the Events section, .bind() should be replaced with .on():

//Alternatively, you can use the bind() method
$('#foo').bind('click', fn);

For reference:
http://api.jquery.com/bind/

As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document.

Open to other libraries/toolkits?

I love the idea of this project, but there's a few other libraries out there that'd benefit from this style of comparison - Dojo, MooTools, Prototype and such.

So I'm asking this (an issue seemed to be the easiest way): Would a pull request with that sort of work be accepted?

I know it's jquery-yui3-rosetta-stone, but given that it's hosted under the more neutral jsrosettastone.com, I'm hopeful. Thanks. :)

.remove()

Add examples on how to remove elements from DOM?

Empty objects

Could you add the translation for checking an object, took me a while to track down and is a useful function.

jQuery
$.isEmptyObject(object)

YUI
Y.Object.isEmpty(object)

thanks

Setting/Getting Attributes

Is the YUI equivilent to .attr() getAttr() or getAttrs? Not sure if it's a typo or I am missing something in my setup.
Thanks.

JQuery clone vs yui cloneNode

Might be useful to cover these differences

in JQuery its node.clone(withDataAndEvents ) //deep clone is mandatory, data and events optional
in YUI it is node.cloneNode(deep) //deep clone optional but deep includes subtree and attributes

Array vs NodeList

YUI 3.3 added the Array 1.5 methods to NodeList, such as concat. This should probably be mentioned.
Also I think you should probably recommend using Y.NodeList.getDomNodes instead of the private ._nodes property, but that is just my personal opinion...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.