-var AttributesList = function() {};
-AttributesList.prototype = Object.create({});
-AttributesList.prototype.keys = function() {
- return _.keys(this);
+var WLXMLDocumentNodeMethods = {
+ isInside: function(query) {
+ var parent = this.getParent(query);
+ return !!parent;
+ },
+ getParent: function(query) {
+ /* globals Node */
+ var me = this.nodeType === Node.ELEMENT_NODE ? [this] : [],
+ toret;
+ me.concat(this.parents()).some(function(node) {
+ if(node.is(query)) {
+ toret = node;
+ }
+ return !!toret || (!node.sameNode(this) && node.isContextRoot());
+ }.bind(this));
+
+ return toret;
+ },
+ isContextRoot: function() {
+ var me = this.nodeType === Node.ELEMENT_NODE ? [this] : [],
+ toret = false;
+ if(!this.parent()) {
+ return true;
+ }
+ me.concat(this.parents()).some(function(node) {
+ if(_.isFunction(node.object.isContextRoot) && node.object.isContextRoot(this)) {
+ toret = true;
+ return true;
+ }
+ }.bind(this));
+ return toret;
+ },
+ getContextRoot: function() {
+ var contextRoot;
+ [this].concat(this.parents()).some(function(n) {
+ if(n.isContextRoot()) {
+ contextRoot = n;
+ return true;
+ }
+ });
+ return contextRoot;
+ },
+ hasSameContextRoot: function(other) {
+ return this.getContextRoot().sameNode(other.getContextRoot());
+ }
+};
+
+var getClassLists = function(klassName) {
+ var toret = [],
+ classParts = [''].concat(klassName.split('.')),
+ classCurrent;
+
+ classParts.forEach(function(part) {
+ classCurrent = classCurrent ? classCurrent + '.' + part : part;
+ toret.push(classCurrent);
+ });
+ return toret;