getting root element
[fnpeditor.git] / src / smartxml / smartxml.js
1 define([
2     'libs/jquery'
3 ], function($) {
4     
5 'use strict';
6
7
8 var Document = function(xml) {
9     var $document = $(xml);
10
11
12     Object.defineProperty(this, 'root', {get: function() { return new ElementNode($document[0])}}); 
13 }
14
15
16 var ElementNode = function(nativeNode) {
17     var myNode = nativeNode,
18         $myNode = $(nativeNode);
19
20
21     this.getTagName = function() {
22         return myNode.tagName.toLowerCase();
23     }
24 };
25
26 return {
27     fromXML: function(xml) {
28         return new Document(xml);
29     }
30 };
31
32 });