Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4881

Show
Ignore:
Timestamp:
08/30/06 17:54:41 (2 years ago)
Author:
sam
Message:

prototype: Backwards compatibility change: For consistency, Element.toggle, Element.show, and Element.hide no longer take an arbitrary number of arguments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/CHANGELOG

    r4880 r4881  
    11*SVN* 
     2 
     3* For consistency, Element.toggle, Element.show, and Element.hide no longer take an arbitrary number of arguments. [sam] 
     4   
     5  !! BACKWARDS COMPATIBILITY CHANGE !! 
     6   
     7  If you have code that looks like this: 
     8    Element.show('page', 'sidebar', 'content'); 
     9  You need to replace it with code like this: 
     10    ['page', 'sidebar', 'content'].each(Element.show); 
    211 
    312* Mix in Form and Form.Element methods to forms and form field elements with $() and $$(). Closes #4448. [Dan Webb, sam] 
  • spinoffs/prototype/src/dom.js

    r4880 r4881  
    6060  }, 
    6161   
    62   toggle: function() { 
    63     for (var i = 0; i < arguments.length; i++) { 
    64       var element = $(arguments[i]); 
    65       Element[Element.visible(element) ? 'hide' : 'show'](element); 
    66     } 
     62  toggle: function(element) { 
     63    element = $(element); 
     64    Element[Element.visible(element) ? 'hide' : 'show'](element); 
    6765  }, 
    6866 
    6967  hide: function() { 
    70     for (var i = 0; i < arguments.length; i++) { 
    71       var element = $(arguments[i]); 
    72       element.style.display = 'none'; 
    73     } 
     68    $(element).style.display = 'none'; 
    7469  }, 
    7570   
    7671  show: function() { 
    77     for (var i = 0; i < arguments.length; i++) { 
    78       var element = $(arguments[i]); 
    79       element.style.display = ''; 
    80     } 
     72    $(element).style.display = ''; 
    8173  }, 
    8274