Domanda

I am newcomer to Javascript and have been tasked with migrating our product's UI from YUI2 to YUI3. It doesn't look like there's a migration guide anywhere, so I'm browsing internet posts and the yui docs for now.

In my global scope, I've temporarily added something like

var Y = YUI().use('*',function(Y){});

I've encountered a YAHOO.util.Dom.get(...) elsewhere which doesn't work with YUI3, and it looks like Y.DOM.byId(...) is the recommended migration. But, I'm getting the error that "Y.DOM" is undefined!

Whoever's using Y.DOM.(...), how did this get resolved?

È stato utile?

Soluzione

I don't know where you found the idea of Y.DOM.byId

Try

var node = Y.one('#elementID');

or if you want to use classes:

var nodes = Y.all('.className');

For more information on how to get nodes in YUI3, see their documentation

EDIT:

<script>
YUI().use('node', function (Y) {
    var node = Y.one('#elementID');
});
</script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top