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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
Index: /Users/jan/webdev/moodev/mootools/trunk/Effects/Fx.CSS.js
===================================================================
@@ -15,9 +15,7 @@
values[1] = values[0];
values[0] = element.getStyle(property);
}
- var parsed = values.map(function(value){
- return Fx.CSS.set(value);
- });
+ var parsed = values.map(Fx.CSS.set);
return {'from': parsed[0], 'to': parsed[1]};
},
Index: /Users/jan/webdev/moodev/mootools/trunk/Native/String.js
===================================================================
@@ -200,7 +200,7 @@
For more information see <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:parseInt>.
Syntax:
- >myString.toInt(base);
+ >myString.toInt([base]);
Arguments:
base - (integer, optional) The base to use (defaults to 10).
@@ -300,7 +300,7 @@
rgbToHex: function(array){
var rgb = this.match(/\d{1,3}/g);
- return (rgb) ? rgb.rgbToHex(array) : false;
+ return (rgb) ? rgb.rgbToHex(array) : null;
}
});
@@ -333,7 +333,7 @@
*/
hexToRgb: function(array){
- if (this.length != 3) return false;
+ if (this.length != 3) return null;
var rgb = [];
for (var i = 0; i < 3; i++){
rgb.push(((this[i].length == 1) ? this[i] + this[i] : this[i]).toInt(16));
@@ -368,12 +368,12 @@
*/
rgbToHex: function(array){
- if (this.length < 3) return false;
+ if (this.length < 3) return null;
if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
var hex = [];
for (var i = 0; i < 3; i++){
var bit = (this[i] - 0).toString(16);
- hex.push((bit.length == 1) ? '0' + bit : bit);
+ hex[i] = (bit.length == 1) ? '0' + bit : bit;
}
return array ? hex : '#' + hex.join('');
}
Index: /Users/jan/webdev/moodev/mootools/trunk/Element/Element.Style.js
===================================================================
@@ -130,7 +130,7 @@
else if (this.currentStyle) result = this.currentStyle[property];
}
if (result){
- var color = result.match(/[rgba]{3,4}\([\d\s,]+\)/);
+ var color = result.match(/rgba?\([\d\s,]+\)/);
if (color) result = result.replace(color[0], color[0].rgbToHex());
}
return (Client.Engine.ie) ? Element.$fixStyle(property, result, this) : result;
Index: /Users/jan/webdev/moodev/mootools/trunk/Element/Element.Event.js
===================================================================
@@ -135,9 +135,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.js
===================================================================
@@ -51,14 +51,18 @@
*/
if ($type(el) == 'string'){
- if (Client.Engine.ie && props && (props.name || props.type)){
- var name = (props.name) ? ' name="' + props.name + '"' : '';
- var type = (props.type) ? ' type="' + props.type + '"' : '';
- delete props.name;
- delete props.type;
- el = '<' + el + name + type + '>';
+ if (el[0] == '<'){
+ el = new Element("div").setHTML(el).firstChild;
+ } else {
+ if (Client.Engine.ie && props && (props.name || props.type)){
+ var name = (props.name) ? ' name="' + props.name + '"' : '';
+ var type = (props.type) ? ' type="' + props.type + '"' : '';
+ delete props.name;
+ delete props.type;
+ el = '<' + el + name + type + '>';
+ }
+ el = document.createElement(el);
}
- el = document.createElement(el);
}
el = $(el);
return (!props || !el) ? el : el.set(props);
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
===================================================================
@@ -33,6 +33,7 @@
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':
|