'libs/underscore',
'smartxml/smartxml',
'smartxml/transformations',
- 'wlxml/extensions/metadata/metadata'
-], function($, _, smartxml, transformations, metadataExtension) {
+ 'wlxml/extensions/metadata/metadata',
+ 'wlxml/extensions/comments/comments'
+], function($, _, smartxml, transformations, metadataExtension, commentExtension) {
'use strict';
});
instance.object = Object.create(_.extend({}, methods, transformations));
_.keys(methods).concat(_.keys(transformations)).forEach(function(key) {
- instance.object[key] = _.bind(instance.object[key], instance);
+ if(_.isFunction(instance.object[key])) {
+ instance.object[key] = _.bind(instance.object[key], instance);
+ }
});
};
getClass: function() {
return this.getAttr('class') || '';
},
+ getClassHierarchy: function() {
+ return getClassLists(this.getClass());
+ },
setClass: function(klass) {
if(klass !== this.klass) {
installObject(this, klass);
return (_.isUndefined(query.klass) || this.getClass().substr(0, query.klass.length) === query.klass) &&
(_.isUndefined(query.tagName) || this.getTagName() === query.tagName);
},
+ hasChild: function(query) {
+ return this.contents().some(function(child) {
+ return child.is(query);
+ }.bind(this));
+ },
getMetaAttributes: function() {
var toret = new AttributesList(),
classParts = [''].concat(this.getClass().split('.')),
smartxml.TextNode.apply(this, arguments);
};
WLXMLTextNode.prototype = Object.create(smartxml.TextNode.prototype);
-$.extend(WLXMLTextNode.prototype, WLXMLDocumentNodeMethods);
+$.extend(WLXMLTextNode.prototype, WLXMLDocumentNodeMethods, {
+ is: function() { return false; }
+});
var WLXMLDocument = function(xml, options) {
this.classMethods = {};
this.classTransformations = {};
- smartxml.Document.call(this, xml, [metadataExtension]);
+ smartxml.Document.call(this, xml, [metadataExtension, commentExtension]);
this.options = options;
};
return this.WLXMLDocumentFromXML(xml).root;
},
- WLXMLDocument: WLXMLDocument
+ WLXMLDocument: WLXMLDocument,
+ getClassHierarchy: getClassLists
};
});
\ No newline at end of file