| Method | Kind | Arguments | Description |
|---|---|---|---|
| stripTags() | instancee | (none) | |
| stripScripts() | (none) | 返回一个把所有的script都移除的字符串。 | |
| escapeHTML() | instance | (none) | 返回一个把所有的HTML标记合适的转义掉的字符串。 |
| unescapeHTML() | instance | (none) | escapeHTML()的反转。 |
| extractScripts() | instance | (none) | 返回一个包含在string中找到的所有<script>的数组。 |
| evalScripts() | instance | (none) | 执行在string中找到的所有<script>。 |
| toQueryParams() | instance | (none) | 把querystring分割才一个用parameter name做index的联合Array,更像一个hash。 |
| parseQuery() | instancee | (none) | 和toQueryParams()一样.. |
| toArray() | instance | (none) | 把字符串转换成字符数组. |
| camelize() | instance | (none) | 转换一个以连字符连接的字符串成一个骆驼法样式的字符串。比如,这个函数在写代码时,把它做为一个样式工具使用是很有用的。 |
因为array扩展于enumerable,所以所有enumberable对象的函数,array都是可以使用的,除此之外,下面的这些也是已经实现了的。
| Method | Kind | Arguments | Description |
|---|---|---|---|
| clear() | (none) | 清空。 | |
| compact() | instance | (none) | 返回一个不包括源array中null或undefined元素的array,此方法不改变源array。 |
| first() | instance | (none) | 返回array的第一个对象。 |
| flatten() | instance | (none) | 通过递归组合array每个元素的子元素(如果该元素也是array)来返回一个“扁平的”一维的array。 |
| indexOf(value) | instance | value: what you are looking for. | 返回给出数字位置(从0算起)的元素,如果在该位置没有找到对象,返回-1。 |
| inspect() | instance | (none) | 重载inspect(),返回更好格式的反映Array每个元素的字符描述。 |
| last() | instance | (none) | 返回最后一个元素。 |
| reverse([applyToSelf]) | instance | applyToSelf: indicates if the array itself should also be reversed. | 反转Array中元素的顺序,如果没有给出参数,或参数为true,则源Array中元素的顺序也反转,否则源Array保持不变。 |
| shift() | instance | (none) | 返回Array的第一个元素并从Array中移除它,Array的Length-1。 |
| without(value1 [, value2 [, .. valueN]]) | instance | value1 ... valueN: values to be excluded if present in the array. | 返回一个把参数列表中包含的元素从源Array中排除的Array。 |
| Method | Kind | Arguments | Description |
|---|---|---|---|
| getElementsByClassName(className [, parentElement]) | className: name of a CSS class associated with the elements, parentElement: object or id of the element that contains the elements being retrieved. | 返回所有CSS className属性等于className参数的元素,如果没有给出parentElement,那么将搜索document body。(此处使用document.body我觉得不如使用document,因为有时有的页面没有body) |
| Property | Type | Description |
|---|---|---|
| KEY_BACKSPACE | 8: Constant. Code for the Backspace key. | |
| KEY_TAB | Number | 9: Constant. Code for the Tab key. |
| KEY_RETURN | Number | 13: Constant. Code for the Return key. |
| KEY_ESC | Number | 27: Constant. Code for the Esc key. |
| KEY_LEFT | Number | 37: Constant. Code for the Left arrow key. |
| KEY_UP | Number | 38: Constant. Code for the Up arrow key. |
| KEY_RIGHT | Number | 39: Constant. Code for the Right arrow key. |
| KEY_DOWN | Number | 40: Constant. Code for the Down arrow key. |
| KEY_DELETE | Number | 46: Constant. Code for the Delete key. |
| observers: | Array | List of cached observers. Part of the internal implementation details of the object. |
| Method | Kind | Arguments | Description |
|---|---|---|---|
| element(event) | static | event: an Event object | 返回事件源对象。 |
| isLeftClick(event) | static | event: an Event object | 如果点击了鼠标左键,返回true. |
| pointerX(event) | static | event: an Event object | 返回鼠标的X座标。 |
| pointerY(event) | static | event: an Event object | 返回鼠标的Y座标。 |
| stop(event) | static | event: an Event object | 使用此函数来中断事件的默认行为并阻止传递(冒泡)。 |
| findElement(event, tagName) | static | event: an Event object, tagName: name of the desired tag. | 从事件源对象开始向上搜索DOM树,直到找到第一个符合tagName的元素 |
| observe(element, name, observer, useCapture) | static | element: object or id, name: event name (like ’click’, ’load’, etc), observer: function to handle the event, useCapture: if true, handles the event in the capture phase and if false in the bubbling phase. | 为对象的某个事件增加一个处理函数。 |
| stopObserving(element, name, observer, useCapture) | static | element: object or id, name: event name (like ’click’), observer: function that is handling the event, useCapture: if true handles the event in the capture phase and if false in the bubbling phase. | 和上面的函数相反。 |
| _observeAndCache(element, name, observer, useCapture) | static | 私有函数,别管它。 | |
| unloadCache() | (none) | 私有函数,别管它。从内存中清除所有的observers缓存。 |
请稍等,评论加载中...