Matthew Taylor![]()
To tell if a Y.Node instance is a fragment, I currently have to do something like this:
var myNode = Y.Node("<div>some markup</div><div>which is a fragment</div>");
var isFragment = myNode._node.nodeType === 11;
I'd like to have an isFragment() method that does this for me. :) I've added a gallery module with this functionality along with tests. It probably isn't the best way of doing it, but it shows exactly what I'm looking for, anyway.
Just checks if node._node.nodeType === 11.
YUI().use('gallery-node-isfragment', function(Y) {
var n = new Y.Node("<div>one</div><div>two</div>");
if (n.isFragment()) {
// node is a DOM fragment
} else {
// node is a real DOM node
}
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info