Take and element, look at it's contents, if it's above a certain threshold, shrink with "more..." button, otherwise leave alone.
6122
function _shrink_wrap(elt_id){

    // Now take what we have, and wrap around some expansion code if
    // it looks like it is too long.
    var _trim_hash = {};
    var _trimit = 100;
    // Only want to compile once.
    var ea_regexp = new RegExp("\<\/a\>", "i"); // detect an <a>
    var br_regexp = new RegExp("\<br\ \/\>", "i"); // detect a <br />

    function _trim_and_store( in_str ){
	
	var retval = in_str;

	// Let there be tests.
	var list_p = br_regexp.test(retval);
	var anchors_p = ea_regexp.test(retval);
	
	// Try and break without breaking anchors, etc.
	var tease = null;
	if( ! anchors_p && ! list_p ){
	    // A normal string then...trim it!
	    //ll("\tT&S: easy normal text, go nuts!");
	    tease = new html.span(bbop.crop(retval, _trimit, '...'),
				  {'generate_id': true});
	}else if( anchors_p && ! list_p ){
	    // It looks like it is a link without a break, so not
	    // a list. We cannot trim this safely.
	    //ll("\tT&S: single link so cannot work on!");
	}else{
	    //ll("\tT&S: we have a list to deal with");
	    
	    var new_str_list = retval.split(br_regexp);
	    if( new_str_list.length <= 3 ){
		// Let's just ignore lists that are only three
		// items.
		//ll("\tT&S: pass thru list length <= 3");
	    }else{
		//ll("\tT&S: contruct into 2 plus tag");
		var new_str = '';
		new_str = new_str + new_str_list.shift();
		new_str = new_str + '<br />';
		new_str = new_str + new_str_list.shift();
		tease = new html.span(new_str, {'generate_id': true});
	    }
	}
	
	// If we have a tease (able to break down incoming string),
	// assemble the rest of the packet to create the UI.
	if( tease ){
	    // Setup the text for tease and full versions.
	    var bgen = function(lbl, dsc){
		var b = new html.button(lbl, {
		    'generate_id': true,
		    'type': 'button',
		    'title': dsc || lbl,
		    //'class': 'btn btn-default btn-xs'
		    'class': 'btn btn-primary btn-xs'
		});
		return b;
	    };
	    var more_b = new bgen('more', 'Display the complete list');
	    var full = new html.span(retval, {'generate_id': true});
	    var less_b = new bgen('less', 'Display the truncated list');
	    
	    // Store the different parts for later activation.
	    var tease_id = tease.get_id();
	    var more_b_id = more_b.get_id();
	    var full_id = full.get_id();
	    var less_b_id = less_b.get_id();
	    _trim_hash[tease_id] = [tease_id, more_b_id, full_id, less_b_id];
	    
	    // New final string.
	    retval = tease.to_string() + " " +
		more_b.to_string() + " " +
		full.to_string() + " " +
		less_b.to_string();
	}
	
	return retval;
    }

    var pre_html = jQuery('#' + elt_id).html();
    if( pre_html && pre_html.length && (pre_html.length > _trimit * 2) ){

	// Get the new value into the wild.
	var new_str = _trim_and_store(pre_html);
	if( new_str !== pre_html ){
	    jQuery('#' + elt_id).html(new_str);  

	    // Bind the jQuery events to it.
	    // Add the roll-up/down events to the doc.
	    us.each(_trim_hash, function(val, key){
    		var tease_id = val[0];
    		var more_b_id = val[1];
    		var full_id = val[2];
    		var less_b_id = val[3];
		
    		// Initial state.
    		jQuery('#' + full_id ).hide();
    		jQuery('#' + less_b_id ).hide();
		
    		// Click actions to go back and forth.
    		jQuery('#' + more_b_id ).click(function(){
    		    jQuery('#' + tease_id ).hide();
    		    jQuery('#' + more_b_id ).hide();
    		    jQuery('#' + full_id ).show('fast');
    		    jQuery('#' + less_b_id ).show('fast');
    		});
    		jQuery('#' + less_b_id ).click(function(){
    		    jQuery('#' + full_id ).hide();
    		    jQuery('#' + less_b_id ).hide();
    		    jQuery('#' + tease_id ).show('fast');
    		    jQuery('#' + more_b_id ).show('fast');
    		});
	    });    
	}
    }
}
865955
function (suggestionNode) {
            if (suggestionNode == null) {
                suggestionNode = Aria.$window.document.activeElement;
                if (suggestionNode.className.indexOf("highlight") === -1) {
                    suggestionNode = this._getSuggestionsContainer().children[this.getHighlightedOptionIndex() - 1];
                }
                // TODO Get currently focused element and check this is an highlighted option...
            }

            if (suggestionNode != null) {
                this._removeClass(suggestionNode, 'highlight');
                suggestionNode.firstChild.removeAttribute('tabindex');
            }
        }
438744
function() {
    var elTable = this._elTable;
    if(elTable) {
        Ev.purgeElement(elTable, true);
        elTable.parentNode.removeChild(elTable);
        this._elCaption = null;
        this._elColgroup = null;
        this._elThead = null;
        this._elTbody = null;
    }
}
89931
function() {
		var i,
			sizeData = this._calculateAbsoluteSizes();

		for( i = 0; i < this.contentItems.length; i++ ) {
			if( sizeData.additionalPixel - i > 0 ) {
				sizeData.itemSizes[ i ]++;
			}

			if( this._isColumn ) {
				this.contentItems[ i ].element.width( sizeData.totalWidth );
				this.contentItems[ i ].element.height( sizeData.itemSizes[ i ] );
			} else {
				this.contentItems[ i ].element.width( sizeData.itemSizes[ i ] );
				this.contentItems[ i ].element.height( sizeData.totalHeight );
			}
		}
	}
489408
public void trimToSize()
    {
        if (elements.length != size && elements.length > INITIAL_CAPACITY)
        {
            elements = Arrays.copyOf(elements, Math.max(INITIAL_CAPACITY, size));
        }
    }
197032
function() {
    var elTable = this._elHdTable;
    if(elTable) {
        Ev.purgeElement(elTable, true);
        elTable.parentNode.removeChild(elTable);
        
        // A little out of place, but where else can we null out these extra elements?
        ///this._elBdColgroup = null;
        this._elBdThead = null;
    }
}
62702
function prepend(element, content) {
  if (isString(content)) {
    return element.insertAdjacentHTML('afterBegin', content);
  } else {
    return element.insertBefore(normalizeContent(content), element.firstChild);
  }
}
864144
function () {
        YAHOO.util.Event.purgeElement(this.container,true);
        this.container.parentNode.removeChild(this.container);
        this.container = null;
    }
684790
private void trimToSize() {
		if (wordsInUse != words.length) {
			words = Arrays.copyOf(words, wordsInUse);
			checkInvariants();
		}
	}
136383
function () {
            if (this.mask) {

                // Shrink mask first, so it doesn't affect the document size.
                var mask = this.mask,
                    viewWidth = Dom.getViewportWidth(),
                    viewHeight = Dom.getViewportHeight();

                if (mask.offsetHeight > viewHeight) {
                    mask.style.height = viewHeight + "px";
                }

                if (mask.offsetWidth > viewWidth) {
                    mask.style.width = viewWidth + "px";
                }

                // Then size it to the document
                mask.style.height = Dom.getDocumentHeight() + "px";
                mask.style.width = Dom.getDocumentWidth() + "px";
            }
        }
1319356
public void clear(final boolean shrink) {
		while (queue.poll() != null) {
			;
		}
		if (elementCount > 0) {
			elementCount = 0;
		}
		if (shrink && (elementData.length > 1024) && (elementData.length > defaultSize)) {
			elementData = newElementArray(defaultSize);
		} else {
			Arrays.fill(elementData, null);
		}
		computeMaxSize();
		while (queue.poll() != null) {
			;
		}
	}
543723
function shrinkList(list, newSize) {
    var size = list.length;
    list.length = newSize;

    if (size < newSize) {
        do {
            delete list[newSize];
        }
        while (newSize-- < size);
    }
}
798945
function discardElement(element) {
	// create a garbage bin element, not part of the DOM
	if (!garbageBin) {
		garbageBin = createElement(DIV);
	}

	// move the node and empty bin
	if (element) {
		garbageBin.appendChild(element);
	}
	garbageBin.innerHTML = '';
}
935518
function () {
        YAHOO.util.Event.purgeElement(this.link);
        this.current.parentNode.removeChild(this.current);
        this.link = this.span = null;
    }
225519
function() {
      
      // Remove from DOM
      if(Dom.inDocument(this.el)) {
         this.el.parentNode.removeChild(this.el);
      }
      
      // recursively purge element
      Event.purgeElement(this.el, true);
   }
149656
def OnContentChange(self, event):
        """"""

        self.ignore_changes = True
        self.SetValue(u"" if event.text is None else event.text)

        self.ignore_changes = False

        event.Skip()
796040
public void trimToSize() {
		if (_size < _data.length) {
			_data = _size == 0
				? EMPTY_ARRAY
				: copyOf(_data, _size);
		}
	}