actionpack 1.12.5 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +517 -15
- data/MIT-LICENSE +1 -1
- data/README +18 -20
- data/Rakefile +7 -4
- data/examples/address_book_controller.rb +3 -3
- data/examples/blog_controller.cgi +3 -3
- data/examples/debate_controller.cgi +5 -5
- data/lib/action_controller.rb +2 -2
- data/lib/action_controller/assertions.rb +73 -311
- data/lib/action_controller/{deprecated_assertions.rb → assertions/deprecated_assertions.rb} +32 -8
- data/lib/action_controller/assertions/dom_assertions.rb +25 -0
- data/lib/action_controller/assertions/model_assertions.rb +12 -0
- data/lib/action_controller/assertions/response_assertions.rb +140 -0
- data/lib/action_controller/assertions/routing_assertions.rb +82 -0
- data/lib/action_controller/assertions/selector_assertions.rb +571 -0
- data/lib/action_controller/assertions/tag_assertions.rb +117 -0
- data/lib/action_controller/base.rb +334 -163
- data/lib/action_controller/benchmarking.rb +3 -6
- data/lib/action_controller/caching.rb +83 -22
- data/lib/action_controller/cgi_ext/cgi_ext.rb +0 -7
- data/lib/action_controller/cgi_ext/cgi_methods.rb +167 -173
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +43 -22
- data/lib/action_controller/cgi_process.rb +50 -27
- data/lib/action_controller/components.rb +21 -25
- data/lib/action_controller/cookies.rb +10 -9
- data/lib/action_controller/{dependencies.rb → deprecated_dependencies.rb} +9 -27
- data/lib/action_controller/filters.rb +448 -225
- data/lib/action_controller/flash.rb +24 -20
- data/lib/action_controller/helpers.rb +2 -5
- data/lib/action_controller/integration.rb +40 -16
- data/lib/action_controller/layout.rb +11 -8
- data/lib/action_controller/macros/auto_complete.rb +3 -2
- data/lib/action_controller/macros/in_place_editing.rb +3 -2
- data/lib/action_controller/mime_responds.rb +41 -29
- data/lib/action_controller/mime_type.rb +68 -10
- data/lib/action_controller/pagination.rb +4 -3
- data/lib/action_controller/request.rb +22 -14
- data/lib/action_controller/rescue.rb +25 -22
- data/lib/action_controller/resources.rb +302 -0
- data/lib/action_controller/response.rb +20 -2
- data/lib/action_controller/response.rb.rej +17 -0
- data/lib/action_controller/routing.rb +1165 -567
- data/lib/action_controller/scaffolding.rb +30 -31
- data/lib/action_controller/session/active_record_store.rb +2 -0
- data/lib/action_controller/session/drb_store.rb +4 -0
- data/lib/action_controller/session/mem_cache_store.rb +4 -0
- data/lib/action_controller/session_management.rb +6 -9
- data/lib/action_controller/status_codes.rb +89 -0
- data/lib/action_controller/streaming.rb +6 -15
- data/lib/action_controller/templates/rescues/_request_and_response.rhtml +5 -5
- data/lib/action_controller/templates/rescues/diagnostics.rhtml +2 -2
- data/lib/action_controller/templates/rescues/routing_error.rhtml +4 -4
- data/lib/action_controller/templates/rescues/template_error.rhtml +1 -1
- data/lib/action_controller/templates/scaffolds/list.rhtml +1 -1
- data/lib/action_controller/test_process.rb +52 -30
- data/lib/action_controller/url_rewriter.rb +63 -29
- data/lib/action_controller/vendor/html-scanner/html/document.rb +1 -0
- data/lib/action_controller/vendor/html-scanner/html/node.rb +3 -4
- data/lib/action_controller/vendor/html-scanner/html/selector.rb +822 -0
- data/lib/action_controller/verification.rb +22 -11
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/version.rb +2 -2
- data/lib/action_view.rb +1 -1
- data/lib/action_view/base.rb +46 -43
- data/lib/action_view/compiled_templates.rb +1 -1
- data/lib/action_view/helpers/active_record_helper.rb +54 -17
- data/lib/action_view/helpers/asset_tag_helper.rb +97 -46
- data/lib/action_view/helpers/capture_helper.rb +1 -1
- data/lib/action_view/helpers/date_helper.rb +258 -136
- data/lib/action_view/helpers/debug_helper.rb +1 -1
- data/lib/action_view/helpers/deprecated_helper.rb +34 -0
- data/lib/action_view/helpers/form_helper.rb +75 -35
- data/lib/action_view/helpers/form_options_helper.rb +7 -5
- data/lib/action_view/helpers/form_tag_helper.rb +44 -6
- data/lib/action_view/helpers/java_script_macros_helper.rb +59 -46
- data/lib/action_view/helpers/javascript_helper.rb +71 -10
- data/lib/action_view/helpers/javascripts/controls.js +41 -23
- data/lib/action_view/helpers/javascripts/dragdrop.js +105 -76
- data/lib/action_view/helpers/javascripts/effects.js +293 -163
- data/lib/action_view/helpers/javascripts/prototype.js +897 -389
- data/lib/action_view/helpers/javascripts/prototype.js.rej +561 -0
- data/lib/action_view/helpers/number_helper.rb +111 -65
- data/lib/action_view/helpers/prototype_helper.rb +84 -109
- data/lib/action_view/helpers/scriptaculous_helper.rb +5 -0
- data/lib/action_view/helpers/tag_helper.rb +69 -16
- data/lib/action_view/helpers/text_helper.rb +149 -112
- data/lib/action_view/helpers/url_helper.rb +200 -107
- data/lib/action_view/template_error.rb +66 -42
- data/test/abstract_unit.rb +4 -2
- data/test/active_record_unit.rb +84 -56
- data/test/activerecord/active_record_assertions_test.rb +26 -18
- data/test/activerecord/active_record_store_test.rb +4 -36
- data/test/activerecord/pagination_test.rb +1 -6
- data/test/controller/action_pack_assertions_test.rb +230 -113
- data/test/controller/addresses_render_test.rb +2 -6
- data/test/controller/assert_select_test.rb +576 -0
- data/test/controller/base_test.rb +73 -3
- data/test/controller/caching_test.rb +228 -0
- data/test/controller/capture_test.rb +12 -10
- data/test/controller/cgi_test.rb +89 -12
- data/test/controller/components_test.rb +24 -2
- data/test/controller/content_type_test.rb +139 -0
- data/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
- data/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
- data/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
- data/test/controller/cookie_test.rb +33 -25
- data/test/controller/deprecated_instance_variables_test.rb +48 -0
- data/test/controller/deprecation/deprecated_base_methods_test.rb +60 -0
- data/test/controller/fake_controllers.rb +0 -1
- data/test/controller/filters_test.rb +301 -16
- data/test/controller/flash_test.rb +19 -2
- data/test/controller/helper_test.rb +2 -2
- data/test/controller/integration_test.rb +154 -0
- data/test/controller/layout_test.rb +115 -1
- data/test/controller/mime_responds_test.rb +94 -0
- data/test/controller/mime_type_test.rb +9 -0
- data/test/controller/new_render_test.rb +161 -11
- data/test/controller/raw_post_test.rb +52 -15
- data/test/controller/redirect_test.rb +27 -14
- data/test/controller/render_test.rb +76 -29
- data/test/controller/request_test.rb +55 -4
- data/test/controller/resources_test.rb +274 -0
- data/test/controller/routing_test.rb +1533 -824
- data/test/controller/selector_test.rb +628 -0
- data/test/controller/send_file_test.rb +9 -1
- data/test/controller/session_management_test.rb +51 -0
- data/test/controller/test_test.rb +113 -29
- data/test/controller/url_rewriter_test.rb +86 -17
- data/test/controller/verification_test.rb +19 -17
- data/test/controller/webservice_test.rb +0 -7
- data/test/fixtures/content_type/render_default_content_types_for_respond_to.rhtml +1 -0
- data/test/fixtures/content_type/render_default_for_rhtml.rhtml +1 -0
- data/test/fixtures/content_type/render_default_for_rjs.rjs +1 -0
- data/test/fixtures/content_type/render_default_for_rxml.rxml +1 -0
- data/test/fixtures/deprecated_instance_variables/_cookies_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_cookies_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_flash_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_headers_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_params_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_request_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_request_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_response_method.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml +1 -0
- data/test/fixtures/deprecated_instance_variables/_session_method.rhtml +1 -0
- data/test/fixtures/multipart/binary_file +0 -0
- data/test/fixtures/public/javascripts/application.js +1 -0
- data/test/fixtures/test/_hello.rxml +1 -0
- data/test/fixtures/test/hello_world_container.rxml +3 -0
- data/test/fixtures/topic.rb +2 -2
- data/test/template/active_record_helper_test.rb +83 -12
- data/test/template/asset_tag_helper_test.rb +75 -95
- data/test/template/compiled_templates_test.rb +1 -0
- data/test/template/date_helper_test.rb +873 -181
- data/test/template/deprecated_helper_test.rb +36 -0
- data/test/template/deprecated_instance_variables_test.rb +43 -0
- data/test/template/form_helper_test.rb +77 -1
- data/test/template/form_options_helper_test.rb +4 -0
- data/test/template/form_tag_helper_test.rb +66 -2
- data/test/template/java_script_macros_helper_test.rb +4 -1
- data/test/template/javascript_helper_test.rb +29 -0
- data/test/template/number_helper_test.rb +63 -27
- data/test/template/prototype_helper_test.rb +77 -34
- data/test/template/tag_helper_test.rb +34 -6
- data/test/template/text_helper_test.rb +69 -34
- data/test/template/url_helper_test.rb +168 -16
- data/test/testing_sandbox.rb +7 -22
- metadata +66 -20
- data/filler.txt +0 -50
- data/lib/action_controller/code_generation.rb +0 -235
- data/lib/action_controller/vendor/xml_simple.rb +0 -1019
- data/test/controller/caching_filestore.rb +0 -74
- data/test/fixtures/application_root/app/controllers/a_class_that_contains_a_controller/poorly_placed_controller.rb +0 -7
- data/test/fixtures/application_root/app/controllers/module_that_holds_controllers/nested_controller.rb +0 -3
- data/test/fixtures/application_root/app/models/a_class_that_contains_a_controller.rb +0 -7
- data/test/fixtures/dont_load.rb +0 -3
@@ -0,0 +1,561 @@
|
|
1
|
+
***************
|
2
|
+
*** 1,4 ****
|
3
|
+
/* Prototype JavaScript framework, version 1.5.0_rc2
|
4
|
+
- * (c) 2005, 2006 Sam Stephenson <sam@conio.net>
|
5
|
+
*
|
6
|
+
* Prototype is freely distributable under the terms of an MIT-style license.
|
7
|
+
--- 1,4 ----
|
8
|
+
/* Prototype JavaScript framework, version 1.5.0_rc2
|
9
|
+
+ * (c) 2005-2007 Sam Stephenson
|
10
|
+
*
|
11
|
+
* Prototype is freely distributable under the terms of an MIT-style license.
|
12
|
+
***************
|
13
|
+
*** 146,149 ****
|
14
|
+
}
|
15
|
+
}
|
16
|
+
Object.extend(String.prototype, {
|
17
|
+
gsub: function(pattern, replacement) {
|
18
|
+
--- 146,153 ----
|
19
|
+
}
|
20
|
+
}
|
21
|
+
+ String.interpret = function(value){
|
22
|
+
+ return value == null ? '' : String(value);
|
23
|
+
+ }
|
24
|
+
+
|
25
|
+
Object.extend(String.prototype, {
|
26
|
+
gsub: function(pattern, replacement) {
|
27
|
+
***************
|
28
|
+
*** 154,158 ****
|
29
|
+
if (match = source.match(pattern)) {
|
30
|
+
result += source.slice(0, match.index);
|
31
|
+
- result += (replacement(match) || '').toString();
|
32
|
+
source = source.slice(match.index + match[0].length);
|
33
|
+
} else {
|
34
|
+
--- 158,162 ----
|
35
|
+
if (match = source.match(pattern)) {
|
36
|
+
result += source.slice(0, match.index);
|
37
|
+
+ result += String.interpret(replacement(match));
|
38
|
+
source = source.slice(match.index + match[0].length);
|
39
|
+
} else {
|
40
|
+
***************
|
41
|
+
*** 248,269 ****
|
42
|
+
},
|
43
|
+
|
44
|
+
camelize: function() {
|
45
|
+
- var oStringList = this.split('-');
|
46
|
+
- if (oStringList.length == 1) return oStringList[0];
|
47
|
+
-
|
48
|
+
- var camelizedString = this.indexOf('-') == 0
|
49
|
+
- ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
|
50
|
+
- : oStringList[0];
|
51
|
+
-
|
52
|
+
- for (var i = 1, length = oStringList.length; i < length; i++) {
|
53
|
+
- var s = oStringList[i];
|
54
|
+
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
|
55
|
+
- }
|
56
|
+
-
|
57
|
+
- return camelizedString;
|
58
|
+
},
|
59
|
+
|
60
|
+
underscore: function() {
|
61
|
+
- return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'-').toLowerCase();
|
62
|
+
},
|
63
|
+
|
64
|
+
--- 252,280 ----
|
65
|
+
},
|
66
|
+
|
67
|
+
+ succ: function() {
|
68
|
+
+ return this.slice(0, this.length - 1) +
|
69
|
+
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
|
70
|
+
+ },
|
71
|
+
+
|
72
|
+
camelize: function() {
|
73
|
+
+ var parts = this.split('-'), len = parts.length;
|
74
|
+
+ if (len == 1) return parts[0];
|
75
|
+
+
|
76
|
+
+ var camelized = this.charAt(0) == '-'
|
77
|
+
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
78
|
+
+ : parts[0];
|
79
|
+
+
|
80
|
+
+ for (var i = 1; i < len; i++)
|
81
|
+
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
82
|
+
+
|
83
|
+
+ return camelized;
|
84
|
+
+ },
|
85
|
+
+
|
86
|
+
+ capitalize: function(){
|
87
|
+
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
|
88
|
+
},
|
89
|
+
|
90
|
+
underscore: function() {
|
91
|
+
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
|
92
|
+
},
|
93
|
+
|
94
|
+
***************
|
95
|
+
*** 301,305 ****
|
96
|
+
var before = match[1];
|
97
|
+
if (before == '\\') return match[2];
|
98
|
+
- return before + (object[match[3]] || '').toString();
|
99
|
+
});
|
100
|
+
}
|
101
|
+
--- 312,316 ----
|
102
|
+
var before = match[1];
|
103
|
+
if (before == '\\') return match[2];
|
104
|
+
+ return before + String.interpret(object[match[3]]);
|
105
|
+
});
|
106
|
+
}
|
107
|
+
***************
|
108
|
+
*** 330,334 ****
|
109
|
+
while ((index += number) < array.length)
|
110
|
+
slices.push(array.slice(index, index+number));
|
111
|
+
- return slices.collect(iterator || Prototype.K);
|
112
|
+
},
|
113
|
+
|
114
|
+
--- 341,345 ----
|
115
|
+
while ((index += number) < array.length)
|
116
|
+
slices.push(array.slice(index, index+number));
|
117
|
+
+ return slices.map(iterator);
|
118
|
+
},
|
119
|
+
|
120
|
+
***************
|
121
|
+
*** 354,358 ****
|
122
|
+
var results = [];
|
123
|
+
this.each(function(value, index) {
|
124
|
+
- results.push(iterator(value, index));
|
125
|
+
});
|
126
|
+
return results;
|
127
|
+
--- 365,369 ----
|
128
|
+
var results = [];
|
129
|
+
this.each(function(value, index) {
|
130
|
+
+ results.push((iterator || Prototype.K)(value, index));
|
131
|
+
});
|
132
|
+
return results;
|
133
|
+
***************
|
134
|
+
*** 401,410 ****
|
135
|
+
|
136
|
+
inGroupsOf: function(number, fillWith) {
|
137
|
+
- fillWith = fillWith || null;
|
138
|
+
- var results = this.eachSlice(number);
|
139
|
+
- if (results.length > 0) (number - results.last().length).times(function() {
|
140
|
+
- results.last().push(fillWith)
|
141
|
+
- });
|
142
|
+
- return results;
|
143
|
+
},
|
144
|
+
|
145
|
+
--- 412,420 ----
|
146
|
+
|
147
|
+
inGroupsOf: function(number, fillWith) {
|
148
|
+
+ fillWith = fillWith === undefined ? null : fillWith;
|
149
|
+
+ return this.eachSlice(number, function(slice) {
|
150
|
+
+ while(slice.length < number) slice.push(fillWith);
|
151
|
+
+ return slice;
|
152
|
+
+ });
|
153
|
+
},
|
154
|
+
|
155
|
+
***************
|
156
|
+
*** 418,422 ****
|
157
|
+
invoke: function(method) {
|
158
|
+
var args = $A(arguments).slice(1);
|
159
|
+
- return this.collect(function(value) {
|
160
|
+
return value[method].apply(value, args);
|
161
|
+
});
|
162
|
+
--- 428,432 ----
|
163
|
+
invoke: function(method) {
|
164
|
+
var args = $A(arguments).slice(1);
|
165
|
+
+ return this.map(function(value) {
|
166
|
+
return value[method].apply(value, args);
|
167
|
+
});
|
168
|
+
***************
|
169
|
+
*** 470,474 ****
|
170
|
+
|
171
|
+
sortBy: function(iterator) {
|
172
|
+
- return this.collect(function(value, index) {
|
173
|
+
return {value: value, criteria: iterator(value, index)};
|
174
|
+
}).sort(function(left, right) {
|
175
|
+
--- 480,484 ----
|
176
|
+
|
177
|
+
sortBy: function(iterator) {
|
178
|
+
+ return this.map(function(value, index) {
|
179
|
+
return {value: value, criteria: iterator(value, index)};
|
180
|
+
}).sort(function(left, right) {
|
181
|
+
***************
|
182
|
+
*** 479,483 ****
|
183
|
+
|
184
|
+
toArray: function() {
|
185
|
+
- return this.collect(Prototype.K);
|
186
|
+
},
|
187
|
+
|
188
|
+
--- 489,493 ----
|
189
|
+
|
190
|
+
toArray: function() {
|
191
|
+
+ return this.map();
|
192
|
+
},
|
193
|
+
|
194
|
+
***************
|
195
|
+
*** 491,494 ****
|
196
|
+
return iterator(collections.pluck(index));
|
197
|
+
});
|
198
|
+
},
|
199
|
+
|
200
|
+
--- 501,508 ----
|
201
|
+
return iterator(collections.pluck(index));
|
202
|
+
});
|
203
|
+
+ },
|
204
|
+
+
|
205
|
+
+ size: function() {
|
206
|
+
+ return this.toArray().length;
|
207
|
+
},
|
208
|
+
|
209
|
+
***************
|
210
|
+
*** 543,547 ****
|
211
|
+
compact: function() {
|
212
|
+
return this.select(function(value) {
|
213
|
+
- return value != undefined || value != null;
|
214
|
+
});
|
215
|
+
},
|
216
|
+
--- 557,561 ----
|
217
|
+
compact: function() {
|
218
|
+
return this.select(function(value) {
|
219
|
+
+ return value != null;
|
220
|
+
});
|
221
|
+
},
|
222
|
+
***************
|
223
|
+
*** 585,588 ****
|
224
|
+
},
|
225
|
+
|
226
|
+
inspect: function() {
|
227
|
+
return '[' + this.map(Object.inspect).join(', ') + ']';
|
228
|
+
--- 599,606 ----
|
229
|
+
},
|
230
|
+
|
231
|
+
+ size: function() {
|
232
|
+
+ return this.length;
|
233
|
+
+ },
|
234
|
+
+
|
235
|
+
inspect: function() {
|
236
|
+
return '[' + this.map(Object.inspect).join(', ') + ']';
|
237
|
+
***************
|
238
|
+
*** 591,594 ****
|
239
|
+
|
240
|
+
Array.prototype.toArray = Array.prototype.clone;
|
241
|
+
|
242
|
+
if(window.opera){
|
243
|
+
--- 609,617 ----
|
244
|
+
|
245
|
+
Array.prototype.toArray = Array.prototype.clone;
|
246
|
+
+
|
247
|
+
+ function $w(string){
|
248
|
+
+ string = string.strip();
|
249
|
+
+ return string ? string.split(/\s+/) : [];
|
250
|
+
+ }
|
251
|
+
|
252
|
+
if(window.opera){
|
253
|
+
***************
|
254
|
+
*** 802,807 ****
|
255
|
+
|
256
|
+
this.transport.open(this.options.method.toUpperCase(), this.url,
|
257
|
+
- this.options.asynchronous, this.options.username,
|
258
|
+
- this.options.password);
|
259
|
+
|
260
|
+
if (this.options.asynchronous)
|
261
|
+
--- 825,829 ----
|
262
|
+
|
263
|
+
this.transport.open(this.options.method.toUpperCase(), this.url,
|
264
|
+
+ this.options.asynchronous);
|
265
|
+
|
266
|
+
if (this.options.asynchronous)
|
267
|
+
***************
|
268
|
+
*** 885,888 ****
|
269
|
+
this.dispatchException(e);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
--- 907,914 ----
|
274
|
+
this.dispatchException(e);
|
275
|
+
}
|
276
|
+
+
|
277
|
+
+ if ((this.getHeader('Content-type') || 'text/javascript').strip().
|
278
|
+
+ match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
|
279
|
+
+ this.evalResponse();
|
280
|
+
}
|
281
|
+
|
282
|
+
***************
|
283
|
+
*** 895,902 ****
|
284
|
+
|
285
|
+
if (state == 'Complete') {
|
286
|
+
- if ((this.getHeader('Content-type') || '').strip().
|
287
|
+
- match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
|
288
|
+
- this.evalResponse();
|
289
|
+
-
|
290
|
+
// avoid memory leak in MSIE: clean up
|
291
|
+
this.transport.onreadystatechange = Prototype.emptyFunction;
|
292
|
+
--- 921,924 ----
|
293
|
+
|
294
|
+
if (state == 'Complete') {
|
295
|
+
// avoid memory leak in MSIE: clean up
|
296
|
+
this.transport.onreadystatechange = Prototype.emptyFunction;
|
297
|
+
***************
|
298
|
+
*** 1058,1063 ****
|
299
|
+
|
300
|
+
Element.extend = function(element) {
|
301
|
+
- if (!element) return;
|
302
|
+
- if (_nativeExtensions || element.nodeType == 3) return element;
|
303
|
+
|
304
|
+
if (!element._extended && element.tagName && element != window) {
|
305
|
+
--- 1080,1084 ----
|
306
|
+
|
307
|
+
Element.extend = function(element) {
|
308
|
+
+ if (!element || _nativeExtensions || element.nodeType == 3) return element;
|
309
|
+
|
310
|
+
if (!element._extended && element.tagName && element != window) {
|
311
|
+
***************
|
312
|
+
*** 1163,1168 ****
|
313
|
+
|
314
|
+
descendants: function(element) {
|
315
|
+
- element = $(element);
|
316
|
+
- return $A(element.getElementsByTagName('*'));
|
317
|
+
},
|
318
|
+
|
319
|
+
--- 1184,1188 ----
|
320
|
+
|
321
|
+
descendants: function(element) {
|
322
|
+
+ return $A($(element).getElementsByTagName('*'));
|
323
|
+
},
|
324
|
+
|
325
|
+
***************
|
326
|
+
*** 1188,1195 ****
|
327
|
+
|
328
|
+
match: function(element, selector) {
|
329
|
+
- element = $(element);
|
330
|
+
if (typeof selector == 'string')
|
331
|
+
selector = new Selector(selector);
|
332
|
+
- return selector.match(element);
|
333
|
+
},
|
334
|
+
|
335
|
+
--- 1208,1214 ----
|
336
|
+
|
337
|
+
match: function(element, selector) {
|
338
|
+
if (typeof selector == 'string')
|
339
|
+
selector = new Selector(selector);
|
340
|
+
+ return selector.match($(element));
|
341
|
+
},
|
342
|
+
|
343
|
+
***************
|
344
|
+
*** 1216,1220 ****
|
345
|
+
|
346
|
+
getElementsByClassName: function(element, className) {
|
347
|
+
- element = $(element);
|
348
|
+
return document.getElementsByClassName(className, element);
|
349
|
+
},
|
350
|
+
--- 1235,1238 ----
|
351
|
+
|
352
|
+
getElementsByClassName: function(element, className) {
|
353
|
+
return document.getElementsByClassName(className, element);
|
354
|
+
},
|
355
|
+
***************
|
356
|
+
*** 1225,1230 ****
|
357
|
+
|
358
|
+
getHeight: function(element) {
|
359
|
+
- element = $(element);
|
360
|
+
- return element.offsetHeight;
|
361
|
+
},
|
362
|
+
|
363
|
+
--- 1243,1247 ----
|
364
|
+
|
365
|
+
getHeight: function(element) {
|
366
|
+
+ return $(element).offsetHeight;
|
367
|
+
},
|
368
|
+
|
369
|
+
***************
|
370
|
+
*** 1252,1255 ****
|
371
|
+
if (!(element = $(element))) return;
|
372
|
+
Element.classNames(element).remove(className);
|
373
|
+
return element;
|
374
|
+
},
|
375
|
+
--- 1269,1278 ----
|
376
|
+
if (!(element = $(element))) return;
|
377
|
+
Element.classNames(element).remove(className);
|
378
|
+
+ return element;
|
379
|
+
+ },
|
380
|
+
+
|
381
|
+
+ toggleClassName: function(element, className) {
|
382
|
+
+ if (!(element = $(element))) return;
|
383
|
+
+ Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
|
384
|
+
return element;
|
385
|
+
},
|
386
|
+
***************
|
387
|
+
*** 1291,1297 ****
|
388
|
+
scrollTo: function(element) {
|
389
|
+
element = $(element);
|
390
|
+
- var x = element.x ? element.x : element.offsetLeft,
|
391
|
+
- y = element.y ? element.y : element.offsetTop;
|
392
|
+
- window.scrollTo(x, y);
|
393
|
+
return element;
|
394
|
+
},
|
395
|
+
--- 1314,1319 ----
|
396
|
+
scrollTo: function(element) {
|
397
|
+
element = $(element);
|
398
|
+
+ var pos = Position.cumulativeOffset(element);
|
399
|
+
+ window.scrollTo(pos[0], pos[1]);
|
400
|
+
return element;
|
401
|
+
},
|
402
|
+
***************
|
403
|
+
*** 1299,1320 ****
|
404
|
+
getStyle: function(element, style) {
|
405
|
+
element = $(element);
|
406
|
+
- var inline = (style == 'float' ?
|
407
|
+
- (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat') : style);
|
408
|
+
- var value = element.style[inline.camelize()];
|
409
|
+
if (!value) {
|
410
|
+
if (document.defaultView && document.defaultView.getComputedStyle) {
|
411
|
+
var css = document.defaultView.getComputedStyle(element, null);
|
412
|
+
- value = css ? css.getPropertyValue(style) : null;
|
413
|
+
} else if (element.currentStyle) {
|
414
|
+
- value = element.currentStyle[inline.camelize()];
|
415
|
+
}
|
416
|
+
}
|
417
|
+
|
418
|
+
if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
|
419
|
+
- value = element['offset'+style.charAt(0).toUpperCase()+style.substring(1)] + 'px';
|
420
|
+
|
421
|
+
if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
|
422
|
+
if (Element.getStyle(element, 'position') == 'static') value = 'auto';
|
423
|
+
-
|
424
|
+
return value == 'auto' ? null : value;
|
425
|
+
},
|
426
|
+
--- 1321,1347 ----
|
427
|
+
getStyle: function(element, style) {
|
428
|
+
element = $(element);
|
429
|
+
+ var camelizedStyle = (style == 'float' ?
|
430
|
+
+ (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat') : style).camelize();
|
431
|
+
+ var value = element.style[camelizedStyle];
|
432
|
+
if (!value) {
|
433
|
+
if (document.defaultView && document.defaultView.getComputedStyle) {
|
434
|
+
var css = document.defaultView.getComputedStyle(element, null);
|
435
|
+
+ value = css ? css[camelizedStyle] : null;
|
436
|
+
} else if (element.currentStyle) {
|
437
|
+
+ value = element.currentStyle[camelizedStyle];
|
438
|
+
}
|
439
|
+
}
|
440
|
+
|
441
|
+
if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
|
442
|
+
+ value = element['offset'+style.capitalize()] + 'px';
|
443
|
+
|
444
|
+
if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
|
445
|
+
if (Element.getStyle(element, 'position') == 'static') value = 'auto';
|
446
|
+
+ if(style == 'opacity') {
|
447
|
+
+ if(value) return parseFloat(value);
|
448
|
+
+ if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
|
449
|
+
+ if(value[1]) return parseFloat(value[1]) / 100;
|
450
|
+
+ return 1.0;
|
451
|
+
+ }
|
452
|
+
return value == 'auto' ? null : value;
|
453
|
+
},
|
454
|
+
***************
|
455
|
+
*** 1322,1329 ****
|
456
|
+
setStyle: function(element, style) {
|
457
|
+
element = $(element);
|
458
|
+
- for (var name in style)
|
459
|
+
- element.style[ (name == 'float' ?
|
460
|
+
- ((typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat') : name).camelize()
|
461
|
+
- ] = style[name];
|
462
|
+
return element;
|
463
|
+
},
|
464
|
+
--- 1349,1369 ----
|
465
|
+
setStyle: function(element, style) {
|
466
|
+
element = $(element);
|
467
|
+
+ for (var name in style) {
|
468
|
+
+ var value = style[name];
|
469
|
+
+ if(name == 'opacity') {
|
470
|
+
+ if (value == 1) {
|
471
|
+
+ value = (/Gecko/.test(navigator.userAgent) &&
|
472
|
+
+ !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
|
473
|
+
+ if(/MSIE/.test(navigator.userAgent) && !window.opera)
|
474
|
+
+ element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
|
475
|
+
+ } else {
|
476
|
+
+ if(value < 0.00001) value = 0;
|
477
|
+
+ if(/MSIE/.test(navigator.userAgent) && !window.opera)
|
478
|
+
+ element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
|
479
|
+
+ 'alpha(opacity='+value*100+')';
|
480
|
+
+ }
|
481
|
+
+ } else if(name == 'float') name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
|
482
|
+
+ element.style[name.camelize()] = value;
|
483
|
+
+ }
|
484
|
+
return element;
|
485
|
+
},
|
486
|
+
***************
|
487
|
+
*** 1652,1656 ****
|
488
|
+
conditions.push('true');
|
489
|
+
if (clause = params.id)
|
490
|
+
- conditions.push('element.id == ' + clause.inspect());
|
491
|
+
if (clause = params.tagName)
|
492
|
+
conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
|
493
|
+
--- 1692,1696 ----
|
494
|
+
conditions.push('true');
|
495
|
+
if (clause = params.id)
|
496
|
+
+ conditions.push('element.getAttribute("id") == ' + clause.inspect());
|
497
|
+
if (clause = params.tagName)
|
498
|
+
conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
|
499
|
+
***************
|
500
|
+
*** 1713,1717 ****
|
501
|
+
matchElements: function(elements, expression) {
|
502
|
+
var selector = new Selector(expression);
|
503
|
+
- return elements.select(selector.match.bind(selector)).collect(Element.extend);
|
504
|
+
},
|
505
|
+
|
506
|
+
--- 1753,1757 ----
|
507
|
+
matchElements: function(elements, expression) {
|
508
|
+
var selector = new Selector(expression);
|
509
|
+
+ return elements.select(selector.match.bind(selector)).map(Element.extend);
|
510
|
+
},
|
511
|
+
|
512
|
+
***************
|
513
|
+
*** 1753,1757 ****
|
514
|
+
Form.Methods = {
|
515
|
+
serialize: function(form) {
|
516
|
+
- return Form.serializeElements($(form).getElements());
|
517
|
+
},
|
518
|
+
|
519
|
+
--- 1793,1797 ----
|
520
|
+
Form.Methods = {
|
521
|
+
serialize: function(form) {
|
522
|
+
+ return Form.serializeElements(Form.getElements(form));
|
523
|
+
},
|
524
|
+
|
525
|
+
***************
|
526
|
+
*** 1768,1777 ****
|
527
|
+
getInputs: function(form, typeName, name) {
|
528
|
+
form = $(form);
|
529
|
+
- var inputs = form.getElementsByTagName('input');
|
530
|
+
|
531
|
+
if (!typeName && !name)
|
532
|
+
- return inputs;
|
533
|
+
-
|
534
|
+
- var matchingInputs = new Array();
|
535
|
+
for (var i = 0, length = inputs.length; i < length; i++) {
|
536
|
+
var input = inputs[i];
|
537
|
+
--- 1808,1816 ----
|
538
|
+
getInputs: function(form, typeName, name) {
|
539
|
+
form = $(form);
|
540
|
+
+ var inputs = form.getElementsByTagName('input'), matchingInputs = [];
|
541
|
+
|
542
|
+
if (!typeName && !name)
|
543
|
+
+ return $A(inputs).map(Element.extend);
|
544
|
+
+
|
545
|
+
for (var i = 0, length = inputs.length; i < length; i++) {
|
546
|
+
var input = inputs[i];
|
547
|
+
***************
|
548
|
+
*** 1969,1973 ****
|
549
|
+
onTimerEvent: function() {
|
550
|
+
var value = this.getValue();
|
551
|
+
- if (this.lastValue != value) {
|
552
|
+
this.callback(this.element, value);
|
553
|
+
this.lastValue = value;
|
554
|
+
--- 2008,2014 ----
|
555
|
+
onTimerEvent: function() {
|
556
|
+
var value = this.getValue();
|
557
|
+
+ var changed = ('string' == typeof this.lastValue && 'string' == typeof value
|
558
|
+
+ ? this.lastValue != value : String(this.lastValue) != String(value));
|
559
|
+
+ if (changed) {
|
560
|
+
this.callback(this.element, value);
|
561
|
+
this.lastValue = value;
|