-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;
+ }