Changeset 6474
- Timestamp:
- 03/27/07 17:53:52 (1 year ago)
- Files:
-
- spinoffs/prototype/trunk/CHANGELOG (modified) (1 diff)
- spinoffs/prototype/trunk/src/form.js (modified) (2 diffs)
- spinoffs/prototype/trunk/test/unit/form.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/trunk/CHANGELOG
r6473 r6474 1 1 *SVN* 2 3 * Fix Form.disable to work again on non-form elements. Closes #6887. [Mislav Marohnić] 2 4 3 5 * Fix an issue with String.prototype.endsWith. Closes #7822. [altblue] spinoffs/prototype/trunk/src/form.js
r6338 r6474 57 57 disable: function(form) { 58 58 form = $(form); 59 form.getElements().each(function(element) { 60 element.blur(); 61 element.disabled = 'true'; 62 }); 59 Form.getElements(form).invoke('disable'); 63 60 return form; 64 61 }, … … 66 63 enable: function(form) { 67 64 form = $(form); 68 form.getElements().each(function(element) { 69 element.disabled = ''; 70 }); 65 Form.getElements(form).invoke('enable'); 71 66 return form; 72 67 }, spinoffs/prototype/trunk/test/unit/form.html
r6322 r6474 185 185 }}, 186 186 187 testFormEnabling: function(){ with(this) { 188 var form = $('form_focus') 189 var input1 = form.focus_disabled 190 var input2 = form.focus_text 191 192 assert(input1.disabled) 193 assert(!input2.disabled) 194 195 form.disable() 196 assert(input1.disabled) 197 assert(input2.disabled) 198 199 form.enable() 200 assert(!input1.disabled) 201 assert(!input2.disabled) 202 203 input1.disable() 204 assert(input1.disabled) 205 206 // non-form elements: 207 var fieldset = $('form_fieldset') 208 var fields = fieldset.immediateDescendants() 209 assert(fields.all(function(select){ return !select.disabled })) 210 211 Form.disable(fieldset) 212 assert(fields.all(function(select){ return select.disabled })) 213 214 Form.enable(fieldset) 215 assert(fields.all(function(select){ return !select.disabled })) 216 }}, 217 187 218 testFormElementEnabling: function(){ with(this) { 188 219 assert($('input_disabled').disabled);