From: Aleksander Ɓukasz Date: Wed, 14 May 2014 13:34:22 +0000 (+0200) Subject: smartxml: Allow for describing node properties X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/8c59ee4d6be4babb8e6a908c07576bff7e2e59f2?hp=ab3a2987b2eaca2555a206ac8d4f73903aa9870f smartxml: Allow for describing node properties Those can be then used by the low level methods to change their behaviors --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index cfae7c7..8039916 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -17,12 +17,21 @@ var DocumentNode = function(nativeNode, document) { throw new Error('undefined document for a node'); } this.document = document; + this.object = {}; this._setNativeNode(nativeNode); }; $.extend(DocumentNode.prototype, { + getProperty: function(propName) { + var toret = this.object[propName]; + if(toret && _.isFunction(toret)) { + toret = toret.call(this); + } + return toret; + }, + transform: function(Transformation, args) { var transformation = new Transformation(this.document, this, args); return this.document.transform(transformation);