~ted/lazr-js/annoying-debug-message

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/collection/arraylist-add.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-09-09 14:20:30 UTC
  • mfrom: (182.1.3 yui-3.2)
  • Revision ID: launchpad@pqm.canonical.com-20100909142030-13w6vo0ixfysxc15
[r=beuno] Update lazr-js to yui-3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.1.2
6
 
build: 56
 
5
version: 3.2.0
 
6
build: 2676
7
7
*/
8
8
YUI.add('arraylist-add', function(Y) {
9
9
 
45
45
 
46
46
    /**
47
47
     * Removes first or all occurrences of an item to the ArrayList.  If a
48
 
     * comparitor is not provided, uses itemsAreEqual method to determine
 
48
     * comparator is not provided, uses itemsAreEqual method to determine
49
49
     * matches.
50
50
     *
51
51
     * @method remove
52
52
     * @param needle { mixed } Item to find and remove from the list
53
53
     * @param all { Boolean } If true, remove all occurrences
54
 
     * @param comparitor { Function } optional a/b function to test equivalence
 
54
     * @param comparator { Function } optional a/b function to test equivalence
55
55
     * @return {ArrayList} the instance
56
56
     * @chainable
57
57
     */
58
 
    remove: function ( needle, all, comparitor ) {
59
 
        comparitor = comparitor || this.itemsAreEqual;
 
58
    remove: function ( needle, all, comparator ) {
 
59
        comparator = comparator || this.itemsAreEqual;
60
60
 
61
61
        for (var i = this._items.length - 1; i >= 0; --i) {
62
 
            if ( comparitor.call( this, needle, this.item( i ) ) ) {
 
62
            if ( comparator.call( this, needle, this.item( i ) ) ) {
63
63
                this._items.splice( i, 1 );
64
64
                if ( !all ) {
65
65
                    break;
71
71
    },
72
72
 
73
73
    /**
74
 
     * Default comparitor for items stored in this list.  Used by remove().
 
74
     * Default comparator for items stored in this list.  Used by remove().
75
75
     *
76
76
     * @method itemsAreEqual
77
77
     * @param a { mixed } item to test equivalence with
85
85
} );
86
86
 
87
87
 
88
 
}, '3.1.2' ,{requires:['arraylist']});
 
88
}, '3.2.0' ,{requires:['arraylist']});