From 8c59ee4d6be4babb8e6a908c07576bff7e2e59f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 14 May 2014 15:34:22 +0200 Subject: [PATCH 1/1] smartxml: Allow for describing node properties Those can be then used by the low level methods to change their behaviors --- src/smartxml/smartxml.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- 2.20.1