Home > Software design >  YUI3 Get children of a element
YUI3 Get children of a element

Time:08-26

I'm trying to get all children of a YUI3 Element like this

Y.one(document.body).children 
// results in undefined

But I see a children attribute here: https://clarle.github.io/yui3/yui/docs/api/classes/Node.html#attr_children

CodePudding user response:

To get YUI attributes, you need to call the #get method for that attribute:

Y.one(document.body).get('children');

Runnable example:

YUI().use('node', function(Y) {
  console.log(Y.one(document.body).get('children'));
});
<script src="https://cdn.rawgit.com/stiemannkj1/0214fdc4cccaa77d6e504320cf70a571/raw/63d260364730fb067f103c00862c7e65685256df/yui-3.18.1_build_yui_yui-min.js"></script>
<div id="wrapper" >
</div>

  • Related