'use strict';
+/* globals Node */
+
// utils
var isMetaAttribute = function(attrName) {
_.keys(methods).concat(_.keys(transformations)).forEach(function(key) {
instance.object[key] = _.bind(instance.object[key], instance);
});
-}
+};
var WLXMLElementNode = function(nativeNode, document) {
smartxml.ElementNode.call(this, nativeNode, document);
return this.getAttr('class') || '';
},
setClass: function(klass) {
- var methods, object;
if(klass !== this.klass) {
installObject(this, klass);
return this.setAttr('class', klass);
var WLXMLDocumentNode = function() {
smartxml.DocumentNode.apply(this, arguments);
-}
+};
WLXMLDocumentNode.prototype = Object.create(smartxml.DocumentNode.prototype);
var WLXMLDocument = function(xml, options) {
ElementNodeFactory: WLXMLElementNode,
loadXML: function(xml) {
smartxml.Document.prototype.loadXML.call(this, xml, {silent: true});
- $(this.dom).find(':not(iframe)').addBack().contents()
+ this.trigger('contentSet');
+ },
+
+ normalizeXML: function(nativeNode) {
+ $(nativeNode).find(':not(iframe)').addBack().contents()
.filter(function() {return this.nodeType === Node.TEXT_NODE;})
.each(function() {
var el = $(this),
}
//}
}
-
+ /* globals document */
el.replaceWith(document.createTextNode(text.transformed));
});
- this.trigger('contentSet');
},
registerClassTransformation: function(Transformation, className) {
thisClassTransformations[Transformation.prototype.name] = function(args) {
var nodeInstance = this;
return nodeInstance.transform(Transformation, args);
- }
+ };
},
registerClassMethod: function(methodName, method, className) {
var name = pair[0],
desc = pair[1];
doc.registerClassTransformation(transformations.createContextTransformation(desc, name), className);
- });
+ });
});
}