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

Changeset 5294

Show
Ignore:
Timestamp:
10/13/06 12:39:09 (3 years ago)
Author:
madrobby
Message:

Prototype: Add clone() method to arrays, fixes #6338 [Tobie Langel]

Files:

Legend:

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

    r5271 r5294  
    11*SVN* 
     2 
     3* Add clone() method to arrays, fixes #6338 [Tobie Langel] 
    24 
    35* Backing out of [5194] (Element.clear) because of issues with IE on certain elements, #6051 
  • spinoffs/prototype/src/array.js

    r4986 r5294  
    7575  }, 
    7676   
     77  clone: function() { 
     78    return [].concat(this); 
     79  }, 
     80   
    7781  inspect: function() { 
    7882    return '[' + this.map(Object.inspect).join(', ') + ']'; 
  • spinoffs/prototype/test/unit/array.html

    r5137 r5294  
    3434      assertEnumEqual([], [1].clear()); 
    3535      assertEnumEqual([], [1,2].clear()); 
     36    }}, 
     37     
     38    testClone: function(){ with(this) { 
     39      assertEnumEqual([], [].clone()); 
     40      assertEnumEqual([1], [1].clone()); 
     41      assertEnumEqual([1,2], [1,2].clone()); 
     42      assertEnumEqual([0,1,2], [0,1,2].clone()); 
     43      var a = [0,1,2]; 
     44      var b = a; 
     45      assertIdentical(a, b); 
     46      b = a.clone(); 
     47      assertNotIdentical(a, b); 
    3648    }}, 
    3749