Prototype Cheat Sheet 1.6

Page 1

Prototype.js cheat sheet

1.6.0.2 designed by thinkweb2.com

Event

Element (constructor)

Enumerable

document

Prototype

Utility Methods

element ( event )

absolutize ( element )

all ( iterator )

fire ( eventName[, memo] )

K ( argument )

$ ( id | element )

extend ( event )

addClassName ( element, className )

any ( iterator )

observe ( eventName, handler )

emptyFunction ( )

$$ ( cssRule )

findElement ( event, tagName )

addMethods ( [methods] )

collect ( iterator )

stopObserving ( eventName[, handler] )

fire ( element, eventName[, memo] )

adjacent ( element[, selectors... ] )

detect ( iterator )

isLeftClick ( event )

ancestors ( element )

each ( iterator )

observe ( element, eventName, handler )

childElements ( element )

pointerX ( event )

$A ( iterable )

Prototype.Browser

$F ( element )

document.viewport

IE

$H ( [obj] )

eachSlice ( size, iterator )

getDimensions ( )

Opera

$R ( start, end[, exclusive = false] )

classNames

entries ( )

getHeight ( )

WebKit

$w ( String )

pointerY ( event )

cleanWhitespace ( element )

find ( iterator )

getScrollOffsets ( )

Gecko

Try.these ( Function... )

stop ( event )

clonePosition ( element, source[, options] )

findAll ( iterator )

getWidth ( )

MobileSafari

document.getElementsByClassName

stopObserving ( element[, eventName[, handler]] )

cumulativeOffset ( element )

grep ( regex, iterator )

cumulativeScrollOffset ( element )

inGroupsOf ( size )

Form

descendantOf ( element, ancestor )

include ( object )

disable ( formElement )

descendants ( element )

inject ( accumulator, iterator )

enable ( formElement )

down ( element[, cssRule ][, index = 0] )

invoke ( methodName[, args ] )

findFirstElement ( formElement )

empty ( element )

map ( iterator )

focusFirstElement ( formElement )

extend ( element )

max ( iterator )

getElements ( formElement )

fire ( eventName[, memo ] )

member ( object )

getInputs ( formElement[, type[, name]] )

firstDescendant ( element )

min ( iterator )

request ( [options] )

getDimensions ( element )

partition ( iterator )

reset ( formElement )

getElementsByClassName

pluck ( propertyName )

serialize ( formElement[, getHash = false] )

getElementsBySelector

reject ( iterator )

getHeight ( element )

select ( iterator )

getOffsetParent ( element )

size ( )

getStyle ( element, property )

include ( substring )

sortBy ( iterator )

getWidth ( element )

inspect ( [useDoubleQuotes] )

toArray ( )

interpolate ( object[, pattern] )

ObjectRange (constructor)

hasClassName ( element, className )

zip ( Sequence..., iterator )

isJSON ( )

include ( value )

serializeElements ( elements[, getHash = false] )

Form.Element activate ( element ) clear ( element ) disable ( element ) enable ( element ) focus ( element ) getValue ( element ) present ( element ) select ( element ) serialize ( element ) setValue ( element, value )

Ajax new Ajax.PeriodicalUpdater ( container, url[, options] ) new Ajax.Request ( url[, options] ) new Ajax.Updater ( container, url[, options] )

hide ( element ) identify ( element ) immediateDescendants insert ( element, {position: content} ) inspect ( element ) makeClipping ( element ) makePositioned ( element ) match ( element, selector ) next ( element[, cssRule][, index = 0] ) nextSiblings ( element ) observe ( element, eventName, handler ) positionedOffset ( element ) previous ( element[, cssRule][, index = 0] ) previousSiblings ( element ) readAttribute ( element, attribute )

Ajax.Responders

recursivelyCollect ( element, property )

register ( responder )

relativize ( element )

unregister ( responder )

remove ( element ) removeClassName ( element, className )

Array (Array.prototype)

replace ( element[, html] )

clear ( )

scrollTo ( element )

clone ( )

select ( element, selector... )

compact ( )

setOpacity ( element, opacity )

each ( iterator )

setStyle ( element, styles )

first ( )

show ( element )

flatten ( )

siblings ( element )

from ( iterable )

stopObserving ( element[, eventName[, handler]] )

indexOf ( value )

toggle ( element )

inspect ( )

toggleClassName ( element, className )

last ( )

undoClipping ( element )

reduce ( )

undoPositioned ( element )

reverse ( [inline = true] )

up ( element[, cssRule][, index = 0] )

size ( )

update ( element[, newContent] )

toArray ( )

viewportOffset ( element )

toJSON ( ) uniq ( ) without ( value... )

Prototype.BrowserFeatures

Class

XPath

addMethods ( methods ) create ( [superclass][, methods... ])

camelize ( ) capitalize ( )

RegExp

dasherize ( )

escape ( string )

Position

empty ( ) endsWith ( substring ) escapeHTML ( ) evalJSON ( [sanitize] )

absolutize

RegExp (RegExp.prototype)

clone

match ( string )

cumulativeOffset offsetParent

evalScripts ( ) extractScripts ( ) gsub ( pattern, replacement )

overlap

PeriodicalExecuter (constructor)

page

stop ( event )

positionedOffset prepare realOffset relativize within

parseQuery ( [separator = &] )

withinIncludingScrolloffsets

Hash (constructor)

scan ( pattern, iterator )

Template (constructor)

clone ( )

startsWith ( substring )

evaluate ( object )

each ( iterator )

strip ( )

get ( key )

stripScripts ( )

inspect ( )

stripTags ( )

keys ( )

sub ( pattern, replacement[, count = 1] )

merge ( object )

succ ( )

set ( key, value )

times ( count )

toJSON ( )

toArray ( )

toObject ( )

toJSON ( )

toQueryString ( )

toQueryParams ( [separator = &] )

unset ( key )

truncate ( [length = 30[, suffix = ‘...’]] )

update ( object )

underscore ( )

values ( )

Object clone ( obj ) extend ( dest, src ) inspect ( obj ) isArray ( obj ) isElement ( obj )

isUndefined ( obj )

wrap ( element, wrapper[, attributes] )

dOffsets.top

viewportOffset.top

succ ( )

toPaddedString ( length[, radix] )

toJSON ( )

var dOffsets = document.viewport.getScrollOffsets();

round ( )

toJSON ( )

Date (Date.prototype)

Offsets/Dimensions

floor ( )

isString ( obj )

values ( obj )

Top

ceil ( )

toColorPart ( )

toQueryString ( obj )

Bottom

new Form.Observer ( element, freq, callback )

Number (Number.prototype)

isNumber ( obj )

toJSON ( obj )

Before

abs ( )

times ( iterator )

toHTML ( obj )

TimedObserver new Form.Element.Observer ( element, freq, callback )

unfilterJSON ( [filter = Prototype.JSONFilter] )

isHash ( obj )

keys ( obj )

Insertion After

unescapeHTML ( )

isFunction ( obj )

visible ( element ) writeAttribute ( element, attribute[, value = true] )

String (String.prototype) blank ( )

cumulativeOffset.top dOffsets.left

fd

document.viewport.getHeight()

viewportOffset.left

Function (Function.prototype) argumentNames ( ) bind ( thisObj[, arg...] )

cumulativeOffset.left

Element

bindAsEventListener ( thisObj[, arg...] ) curry ( arg... ) defer ( arg... ) delay ( seconds[, arg...] ) methodize ( ) wrap ( wrapperFunction[, arg...] )

document.viewport.getWidth()


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.