blob: e99bd5c1cc619df10cdf859d77e625a234175832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Karma Framework
* http://karmaeducation.org
*
* This code is licensed under the MIT open-source license
* Copyright (c) 2009
* Felipe López Toledo zer.subzero@gmail.com
* Bryan W Berry bryan@olenepal.org
*
*/
/**
* @fileOverview Contains karma library
* @version 0.2
* @authors Felipe Lopez Toledo <zer.subzero@gmail.com>, Bryan Berry <bryan@karmaeducation.org>
*/
/**
* See <a href="http://jquery.com">jQuery</a>.
* @name jQuery
* @exports $ as jQuery
*/
var Karma = function (options) {
var karmaRoot;
var karma;
return Karma.create(Karma.karma).init(options);
};
//helper functions, all in the Karma namespace
//This emulates the Object.create method in ecmascript 5 spec
//This isn't a full implementation as it doesn't support
//Object.defineProperty
//This has the same functionality as Crockford's beget method
//and this primary building block for prototypal inheritance in
//this library
Karma.create = function (object){
function F () {};
F.prototype = object;
return new F();
};
//this is a shallow copy
Karma.clone = function (object){
var copy = {};
for ( var i in object ) {
copy[i] = object[i];
}
return copy;
};
//this copies all the enumerable properties in source to target
Karma.objectPlus = function (target, source){
for ( var i in source){
if (source.hasOwnProperty(i)){
target[i] = source[i];
}
}
return target;
};
//Creates a new object that is a prototype of the first argument
// then extends it with the properties of the second argument
Karma.copyObjectPlus = function (parent1, parent2){
function F () {};
F.prototype = parent1;
var G = new F();
return Karma.objectPlus(G, parent2);
};
Karma.checkLocalised = function ( localised ) {
if ( typeof localised === "boolean" ) {
return localised;
}
}};
Karma.karma = {
init: function(options) {
this.name = "karma";
this.valid();
return this;
},
valid: function(options){
}
};
|