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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
Index: /Users/jan/webdev/moodev/mootools/trunk/Native/String.js
===================================================================
@@ -38,13 +38,13 @@
/*
Property: toInt
parses a string to an integer.
+
+ Arguments:
+ base - (number, optional) base to use, defaults to 10.
Returns:
- either an int or "NaN" if the string is not a number.
+ either an int or NaN if the string is not a number.
- Arguments:
- base - number, optional; base to use, defaults to 10
-
Example:
>var value = "10px".toInt(); // value is 10
*/
Index: /Users/jan/webdev/moodev/mootools/trunk/Native/Number.js
===================================================================
@@ -43,8 +43,8 @@
Limits the number.
Arguments:
- min - number, minimum value
- max - number, maximum value
+ min - (number) minimum value, can be skipped by passing null
+ max - (number) maximum value, can be skipped by passing null or leaving out
Returns:
the number in the given limits.
Index: /Users/jan/webdev/moodev/mootools/trunk/Element/Element.Event.js
===================================================================
@@ -30,13 +30,11 @@
Example:
(start code)
- $('myLink').onkeydown = function(event){
- var event = new Event(event);
- //event is now the Event class.
+ $('myLink').addEvent('keydown', function(event){
alert(event.key); //returns the lowercase letter pressed
alert(event.shift); //returns true if the key pressed is shift
if (event.key == 's' && event.control) alert('document saved');
- };
+ });
(end)
*/
@@ -135,9 +133,8 @@
Example:
(start code)
Event.keys.whatever = 80;
- $(myelement).addEvent(keydown, function(event){
- event = new Event(event);
- if (event.key == 'whatever') console.log(whatever key clicked).
+ $(myelement).addEvent('keydown', function(event){
+ if (event.key == 'whatever') console.log('whatever key clicked').
});
(end)
*/
Index: /Users/jan/webdev/moodev/mootools/trunk/Element/Element.Form.js
===================================================================
@@ -26,10 +26,10 @@
if (option.selected) values.push($pick(option.value, option.text));
});
return (this.multiple) ? values : values[0];
- case 'input': if (!(this.checked && ['checkbox', 'radio'].contains(this.type)) && !['hidden', 'text', 'password'].contains(this.type)) break;
+ case 'input': if (['checkbox', 'radio'].contains(this.type) && !this.checked) return false;
case 'textarea': return this.value;
}
- return false;
+ return null;
},
getFormElements: function(){
Index: /Users/jan/webdev/moodev/mootools/trunk/Remote/Json.js
===================================================================
@@ -30,9 +30,11 @@
*/
encode: function(obj){
+ if(obj.toJSON) return obj.toJSON();
switch ($type(obj)){
case 'string':
return '"' + obj.replace(/[\x00-\x1f\\"]/g, Json.$replaceChars) + '"';
+ case 'arguments': obj = $A(obj);
case 'array':
return '[' + obj.map(Json.encode).filter($defined).join(',') + ']';
case 'object':
@@ -60,7 +62,7 @@
converts a json string to an javascript Object.
Arguments:
- str - the string to evaluate. if its not a string, it returns null.
+ str - the string to evaluate. If it is not a string, it returns null.
secure - optionally, performs syntax check on json string. Defaults to false.
Credits:
|