Get the current value of the first element in the set of
matched elements or set the value of every matched element.
546626
function val(value) {
  var first = this.get(0);

  function getValue(el) {
    var nm = el.tagName.toLowerCase()
      , type = el.getAttribute('type');
    if(nm === SELECT) {
      return getSelectValues(el).join(
        el.getAttribute('data-delimiter') || ',');
    }else if(type === CHECKBOX) {
      return Boolean(el.checked);
    }
    return el.value;
  }

  function setValue(el, value) {
    var nm = el.tagName.toLowerCase()
      , type = el.getAttribute('type');
    if(nm === TEXTAREA) {
      while(el.childNodes.length) {
        el.removeChild(el.childNodes[0])
      }
      el.appendChild(document.createTextNode(value));
    }else if(nm === SELECT) {
      setSelectValues(el, value);
    }else if(type === RADIO) {
      el.setAttribute('checked', '');
    }else if(type === CHECKBOX && Boolean(value)) {
      el.checked = true;
    }else{
      el.value = value;
    }
  }

  if(value === undefined && first) {
    return getValue(first);
  }else if(value) {
    this.each(function(el) {
      setValue(el, value);
    })
  }
  return this;
}
1205138
function setToPairs(set) {
    var index = -1,
        result = Array(set.size);

    set.forEach(function(value) {
      result[++index] = [value, value];
    });
    return result;
  }
1001217
def get_first_of_element(element, sub, contype=None):
    
    content = element.xpath(sub)
    return list_or_empty(content, contype)
735172
function hidden(val) {
  // return whether the first element in the set
  // is hidden
  if(val === undefined) {
    return this.attr(attr);
  // hide on truthy
  }else if(val) {
    this.attr(attr, '1');
  // show on falsey
  }else{
    this.attr(attr, null);
  }
  return this;
}
1065593
function (collection, elements, settings, index) {
            for (var i = index + 1; i < elements.length; i++) {
                elements = swapElements(collection, elements, i - 1, i);
            }
            return collection.find(settings.elements_selector);
        }
1363103
protected void setValue(int newPosition, T1[] values, int number,
      boolean currentExisting) {
    if (number > 0) {
      if (currentExisting) {
        T1[] tmpList = operations
            .createVector1(newFullValueList[newPosition].length + number);
        System.arraycopy(newFullValueList[newPosition], 0, tmpList, 0,
            newFullValueList[newPosition].length);
        System.arraycopy(values, 0, tmpList,
            newFullValueList[newPosition].length, number);
        newFullValueList[newPosition] = tmpList;
      } else {
        if (number < values.length) {
          T1[] tmpList = operations.createVector1(number);
          System.arraycopy(values, 0, tmpList, 0, number);
          newFullValueList[newPosition] = tmpList;
        } else {
          newFullValueList[newPosition] = values;
        }
      }
    }
  }
1202456
public T set(int index, T element)
    {
        switch (index)
        {
            case 0:
                T previousElement1 = this.element1;
                this.element1 = element;
                return previousElement1;
            case 1:
                T previousElement2 = this.element2;
                this.element2 = element;
                return previousElement2;
            default:
                throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + this.size());
        }
    }
1239181
function( elems, name, selector ) {

		// Build a new jQuery matched element set
		var ret = jQuery.merge( this.constructor(), elems );

		// Add the old object onto the stack (as a reference)
		ret.prevObject = this;

		ret.context = this.context;

		if ( name === "find" ) {
			ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
		} else if ( name ) {
			ret.selector = this.selector + "." + name + "(" + selector + ")";
		}

		// Return the newly-formed element set
		return ret;
	}
361877
function set(name, element, previous, props) {
  if (set.handlers[name]) {
    set.handlers[name](name, element, previous, props);
  } else if (previous[name] !== props[name]) {
    element[name] = props[name];
  }
}
1033639
function() {
                        // Get an array of the currently selected values
                        var value = this.get(),
                            currentValue = this.options.value();

                        // If the compute is a string, set its value to the joined version of the values array (i.e. "foo;bar")
                        if (this.isString || typeof currentValue === "string") {
                            this.isString = true;
                            this.options.value(value.join(this.delimiter));
                        }
                        // If the compute is a can.List, replace its current contents with the new array of values
                        else if (currentValue instanceof can.List) {
                            currentValue.attr(value, true);
                        }
                        // Otherwise set the value to the array of values selected in the input.
                        else {
                            this.options.value(value);
                        }

                    }
881520
def each(offset = 0)
      return to_enum(:each, offset) unless block_given?
      @collection[offset..-1].each { |element| yield(element) }
      unless exhausted?
        offset = [@collection.size, offset].max
        fetch_next
        each(offset, &Proc.new)
      end
      self
    end
777841
def each
      current = first()
      return if current.nil?
      yield current
      current_delegate = current.ffi_delegate
      while current_delegate = current_delegate.next
        break if current_delegate.null?
        yield CZTop::Config.from_ffi_delegate(current_delegate)
      end
    end
906411
function (elements, attribute, value) {
            var foundElements = [], value = value || null;
            for (i = 0; i < elements.length; i++) {
                // If the value parameter is set, return only the
                // elements that has the given attribute value.
                if (value !== null) {
                    if (elements[i].getAttribute(attribute) === value)
                        foundElements.push(elements[i]);
                } else {
                    if (elements[i].getAttribute(attribute) !== null)
                        foundElements.push(elements[i]);
                }
            }

            return foundElements;
        }
228020
function(sel) {
      if (!this.length) {
        return this;
      }
      var matched = [],
    	 		el = this[0];

    	while (el = el.previousElementSibling) {
    		sel ?
    			(u(el).is(sel) && matched.push(el)) :
    			matched.push(el);
    	}
    	return u(matched);
    }
1354754
function (elements, value) {
            var foundElements = [];
            for (var i = 0; i < elements.length; i++)
                if (elements[i].value === value)
                    foundElements.push(elements[i]);
            return foundElements;
        }
1015681
def first_with(self, x):
        """"""

        def _find(x):
            try:
                for arg in self.all:
                    if x in arg:
                        return self.all.index(arg)
            except ValueError:
                return None

        if is_collection(x):
            for item in x:
                found = _find(item)
                if found:
                    return found
            return None
        else:
            return _find(x)
187312
function (collection, elements, settings, oldIndex, newIndex) {
            for (var i = oldIndex + 1; (i <= newIndex); i++) {
                elements = swapElements(collection, elements, i, i - 1);
            }
            return collection.find(settings.elements_selector);
        }