All the methods defined here are automatically added to any element accessed using the $() function.
So writing Element.show('firstDiv'); is the same as writing $('firstDiv').show();
Prototype Element Method:
| Method | Description |
| Turns element into an absolutely-positioned element without changing its position in the page layout. | |
| Adds the given CSS class name to the element's class names. | |
| Makes it possible to mix in your own methods to the Element object, which you can later use as methods of extended elements
| |
| Finds all siblings of the current element that match the given selector(s). | |
| Collects all of element's ancestors and returns them as an array of extended elements. | |
| Collects all of the element's children and returns them as an array of extended elements. | |
| classNames() | Deprecated. Returns a new instance of ClassNames, an Enumerable object used to read and write CSS class names of element. |
| Removes all of element's text nodes which contain only whitespace. Returns element. | |
| Clones the position and/or dimensions of source onto element as defined by the optional argument options. | |
| Returns the offsets of element from the top left corner of the document. | |
| Calculates the cumulative scroll offset of an element in nested scrolling containers. | |
| Checks if element is a descendant of ancestor. | |
| Collects all of element's descendants and returns them as an array of extended elements. | |
| Returns element's first descendant that matches cssRule. If no cssRule is provided, all descendants are considered. If no descendant matches these criteria, undefined is returned. | |
| Tests whether element is empty (i.e. contains only whitespace). | |
| Extends element with all of the methods contained in Element.Methods and Element.Methods.Simulated. | |
| Fires a custom event with the current element as its target. | |
| Returns the first child that is an element. This is opposed to firstChild DOM property which will return any node. | |
| Finds the computed width and height of element and returns them as key/value pairs of an object. | |
| getElementsByClassName | Deprecated. Fetches all of element's descendants which have a CSS class of className and returns them as an array of extended elements. Please use $$(). |
| getElementsBySelector | Deprecated. Takes an arbitrary number of CSS selectors (strings) and returns an array of extended children of element that match any of them. Please use $$(). |
| Finds and returns the computed height of element. | |
| Returns element's closest positioned ancestor. If none is found, the body element is returned. | |
| Returns the given CSS property value of element. property can be specified in either of its CSS or camelized form. | |
| Finds and returns the computed width of element. | |
| Checks whether element has the given CSS className. | |
| Hides and returns element. | |
| Returns element's id attribute if it exists, or sets and returns a unique, auto-generated id. | |
| immediateDescendants() | Deprecated. Collects all of the element's immediate descendants (i.e. children) and returns them as an array of extended elements. Please use childElements(). |
| Inserts content before, after, at the top of, or at the bottom of element. | |
| Returns the debug-oriented string representation of element. | |
| Simulates the poorly supported CSS clip property by setting element's overflow value to 'hidden'. Returns element. | |
| Allows for the easy creation of CSS containing block by setting element's CSS position to 'relative' if its initial position is either 'static' or undefined. Returns element. | |
| Checks if element matches the given CSS selector. | |
| Returns element's following sibling that matches the given cssRule. | |
| Collects all of element's next siblings and returns them as an array of extended elements. | |
| Registers an event handler on element and returns element. | |
| Returns element's offset relative to its closest positioned ancestor | |
| Returns element's previous sibling that matches the given cssRule. | |
| Collects all of element's previous siblings and returns them as an array of extended elements. | |
| Returns the value of element's attribute or null if attribute has not been specified. | |
| Recursively collects elements whose relationship is specified by property | |
| Turns element into an relatively-positioned element without changing its position in the page layout. | |
| Completely removes element from the document and returns it. | |
| Removes element's CSS className and returns element. | |
| Replaces element by the content of the html argument and returns the removed element. | |
| Scrolls the window so that element appears at the top of the viewport. Returns element. | |
| Takes an arbitrary number of CSS selectors (strings) and returns an array of extended descendants of element that match any of them. | |
| Sets the visual opacity of an element while working around inconsistencies in various browsers. | |
| Modifies element's CSS style properties. | |
| Displays and returns element. | |
| Collects all of element's siblings and returns them as an array of extended elements. | |
| Unregisters handler and returns element. | |
| Toggles the visibility of element. | |
| Toggles element's CSS className and returns element. | |
| Sets element's CSS overflow property back to the value it had before Element.makeClipping() was applied. Returns element. | |
| Sets element back to the state it was before Element.makePositioned was applied to it. Returns element. | |
| Returns element's first ancestor that matches the given cssRule. | |
| Replaces the content of element with the provided newContent argument and returns element. | |
| Returns the X/Y coordinates of element relative to the viewport. | |
| Returns a Boolean indicating whether or not element is visible | |
| Wraps an element inside another, then returns the wrapper. | |
| Adds, specifies or removes attributes passed as either a hash or a name/value pair. |

No comments:
Post a Comment