summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/MochiKit/MockDOM.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/MochiKit/MockDOM.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/MochiKit/MockDOM.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/frontend/gamma/js/MochiKit/MockDOM.js b/frontend/gamma/js/MochiKit/MockDOM.js
index abdb54a..7e6d60b 100644
--- a/frontend/gamma/js/MochiKit/MockDOM.js
+++ b/frontend/gamma/js/MochiKit/MockDOM.js
@@ -1,68 +1,65 @@
1/*** 1/***
2 2
3MochiKit.MockDOM 1.5 3MochiKit.MockDOM 1.5
4 4
5See <http://mochikit.com/> for documentation, downloads, license, etc. 5See <http://mochikit.com/> for documentation, downloads, license, etc.
6 6
7(c) 2005 Bob Ippolito. All rights Reserved. 7(c) 2005 Bob Ippolito. All rights Reserved.
8 8
9***/ 9***/
10 10
11if (typeof(MochiKit) == "undefined") { 11var MochiKit = MochiKit || {};
12 MochiKit = {};
13}
14 12
15if (typeof(MochiKit.MockDOM) == "undefined") { 13MochiKit.MockDOM = MochiKit.MockDOM || {};
16 MochiKit.MockDOM = {};
17}
18 14
19MochiKit.MockDOM.NAME = "MochiKit.MockDOM"; 15MochiKit.MockDOM.NAME = "MochiKit.MockDOM";
20MochiKit.MockDOM.VERSION = "1.5"; 16MochiKit.MockDOM.VERSION = "1.5";
17MochiKit.MockDOM.__export__ = false;
21 18
22MochiKit.MockDOM.__repr__ = function () { 19MochiKit.MockDOM.__repr__ = function () {
23 return "[" + this.NAME + " " + this.VERSION + "]"; 20 return "[" + this.NAME + " " + this.VERSION + "]";
24}; 21};
25 22
26/** @id MochiKit.MockDOM.toString */ 23/** @id MochiKit.MockDOM.toString */
27MochiKit.MockDOM.toString = function () { 24MochiKit.MockDOM.toString = function () {
28 return this.__repr__(); 25 return this.__repr__();
29}; 26};
30 27
31/** @id MochiKit.MockDOM.createDocument */ 28/** @id MochiKit.MockDOM.createDocument */
32MochiKit.MockDOM.createDocument = function () { 29MochiKit.MockDOM.createDocument = function () {
33 var doc = new MochiKit.MockDOM.MockElement("DOCUMENT"); 30 var doc = new MochiKit.MockDOM.MockElement("DOCUMENT");
34 doc.body = doc.createElement("BODY"); 31 doc.body = doc.createElement("BODY");
35 doc.appendChild(doc.body); 32 doc.appendChild(doc.body);
36 return doc; 33 return doc;
37}; 34};
38 35
39/** @id MochiKit.MockDOM.MockElement */ 36/** @id MochiKit.MockDOM.MockElement */
40MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) { 37MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) {
41 this.tagName = this.nodeName = name.toUpperCase(); 38 this.tagName = this.nodeName = name.toUpperCase();
42 this.ownerDocument = ownerDocument || null; 39 this.ownerDocument = ownerDocument || null;
43 if (name == "DOCUMENT") { 40 if (name == "DOCUMENT") {
44 this.nodeType = 9; 41 this.nodeType = 9;
45 this.childNodes = []; 42 this.childNodes = [];
46 } else if (typeof(data) == "string") { 43 } else if (typeof(data) == "string") {
47 this.nodeValue = data; 44 this.nodeValue = data;
48 this.nodeType = 3; 45 this.nodeType = 3;
49 } else { 46 } else {
50 this.nodeType = 1; 47 this.nodeType = 1;
51 this.childNodes = []; 48 this.childNodes = [];
52 } 49 }
53 if (name.substring(0, 1) == "<") { 50 if (name.substring(0, 1) == "<") {
54 var nameattr = name.substring( 51 var nameattr = name.substring(
55 name.indexOf('"') + 1, name.lastIndexOf('"')); 52 name.indexOf('"') + 1, name.lastIndexOf('"'));
56 name = name.substring(1, name.indexOf(" ")); 53 name = name.substring(1, name.indexOf(" "));
57 this.tagName = this.nodeName = name.toUpperCase(); 54 this.tagName = this.nodeName = name.toUpperCase();
58 this.setAttribute("name", nameattr); 55 this.setAttribute("name", nameattr);
59 } 56 }
60}; 57};
61 58
62MochiKit.MockDOM.MockElement.prototype = { 59MochiKit.MockDOM.MockElement.prototype = {
63 /** @id MochiKit.MockDOM.MockElement.prototype.createElement */ 60 /** @id MochiKit.MockDOM.MockElement.prototype.createElement */
64 createElement: function (tagName) { 61 createElement: function (tagName) {
65 return new MochiKit.MockDOM.MockElement(tagName, null, this.nodeType == 9 ? this : this.ownerDocument); 62 return new MochiKit.MockDOM.MockElement(tagName, null, this.nodeType == 9 ? this : this.ownerDocument);
66 }, 63 },
67 /** @id MochiKit.MockDOM.MockElement.prototype.createTextNode */ 64 /** @id MochiKit.MockDOM.MockElement.prototype.createTextNode */
68 createTextNode: function (text) { 65 createTextNode: function (text) {