In the YUI documentation; http://yuilibrary.com/yui/docs/api/files/dom_js_dom-create.js.html
if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment"
ret = nodes[0].parentNode.removeChild(nodes[0]);
} else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected)
if (nodes.length === 2) {
ret = nodes[0].nextSibling;
} else {
nodes[0].parentNode.removeChild(nodes[0]);
ret = Y_DOM._nl2frag(nodes, doc);
}
} else { // return multiple nodes as a fragment
ret = Y_DOM._nl2frag(nodes, doc);
}
Line 110 says that
} else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected)
What does this mean exactly? I don't understand why there is be a class named 'yui3-big-dummy'
It's because they use that class further down on their own internal stuff, and they just don't want to stick a class there that someone will actually use. You'll notice down on line 317 that they're putting some stuff in there using that class, and they're trying to target that. It's just some internal stuff that you generally won't have to worry about.
return Y_DOM.create('<select><option class="yui3-big-dummy" selected></option>' + html + '</select>', doc);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With