The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 1 more by this user. Created: 09/3/10
Project: YUI 3
License: YUI BSD
YUI Version: 3.2.0 PR2
Free for use.
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.
All code on this site is licensed under the BSD License unless stated otherwise.