X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/fd6329db57fc3cc1cf2305da8d0127de4f2198e2..058d6f3448085c6f1d513691f8f2d5a12ae1d10a:/src/smartxml/smartxml.js diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index d74ec13..2ed9c47 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -305,7 +305,7 @@ $.extend(Document.prototype, Backbone.Events, { loadXML: function(xml, options) { options = options || {}; - defineDocumentProperties(this, $(parseXML(xml))); + this._defineDocumentProperties($(parseXML(xml))); if(!options.silent) { this.trigger('contentSet'); } @@ -452,18 +452,19 @@ $.extend(Document.prototype, Backbone.Events, { toret = toret.contents()[idx]; }); return toret; + }, + + _defineDocumentProperties: function($document) { + var doc = this; + Object.defineProperty(doc, 'root', {get: function() { + return doc.createDocumentNode($document[0]); + }, configurable: true}); + Object.defineProperty(doc, 'dom', {get: function() { + return $document[0]; + }, configurable: true}); } }); -var defineDocumentProperties = function(doc, $document) { - Object.defineProperty(doc, 'root', {get: function() { - return doc.createDocumentNode($document[0]); - }, configurable: true}); - Object.defineProperty(doc, 'dom', {get: function() { - return $document[0]; - }, configurable: true}); -}; - return { documentFromXML: function(xml) {