/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/NodeList-traverse",["./query","./_base/lang","./_base/array"],function(g,h,l){var k=g.NodeList;h.extend(k,{_buildArrayFromCallback:function(c){for(var a=[],d=0;d<this.length;d++){var b=c.call(this[d],this[d],a);b&&(a=a.concat(b))}return a},_getUniqueAsNodeList:function(c){for(var a=[],d=0,b;b=c[d];d++)1==b.nodeType&&-1==l.indexOf(a,b)&&a.push(b);return this._wrap(a,null,this._NodeListCtor)},_getUniqueNodeListWithParent:function(c,a){var d=this._getUniqueAsNodeList(c);d=a?g._filterResult(d,
a):d;return d._stash(this)},_getRelatedUniqueNodes:function(c,a){return this._getUniqueNodeListWithParent(this._buildArrayFromCallback(a),c)},children:function(c){return this._getRelatedUniqueNodes(c,function(a,d){return h._toArray(a.childNodes)})},closest:function(c,a){return this._getRelatedUniqueNodes(null,function(d,b){do if(g._filterResult([d],c,a).length)return d;while(d!=a&&(d=d.parentNode)&&1==d.nodeType);return null})},parent:function(c){return this._getRelatedUniqueNodes(c,function(a,d){return a.parentNode})},
parents:function(c){return this._getRelatedUniqueNodes(c,function(a,d){for(var b=[];a.parentNode;)a=a.parentNode,b.push(a);return b})},siblings:function(c){return this._getRelatedUniqueNodes(c,function(a,d){for(var b=[],e=a.parentNode&&a.parentNode.childNodes,f=0;f<e.length;f++)e[f]!=a&&b.push(e[f]);return b})},next:function(c){return this._getRelatedUniqueNodes(c,function(a,d){for(var b=a.nextSibling;b&&1!=b.nodeType;)b=b.nextSibling;return b})},nextAll:function(c){return this._getRelatedUniqueNodes(c,
function(a,d){for(var b=[],e=a;e=e.nextSibling;)1==e.nodeType&&b.push(e);return b})},prev:function(c){return this._getRelatedUniqueNodes(c,function(a,d){for(var b=a.previousSibling;b&&1!=b.nodeType;)b=b.previousSibling;return b})},prevAll:function(c){return this._getRelatedUniqueNodes(c,function(a,d){for(var b=[],e=a;e=e.previousSibling;)1==e.nodeType&&b.push(e);return b})},andSelf:function(){return this.concat(this._parent)},first:function(){return this._wrap(this[0]&&[this[0]]||[],this)},last:function(){return this._wrap(this.length?
[this[this.length-1]]:[],this)},even:function(){return this.filter(function(c,a){return 0!=a%2})},odd:function(){return this.filter(function(c,a){return 0==a%2})}});return k});