码迷,mamicode.com
首页 > Web开发 > 详细

jQuery 工具函数

时间:2018-08-25 15:33:00      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:merge   not   方法   contents   oge   rem   而不是   length   sea   

jQuery.contains() : Check to see if a DOM element is a descendant of another DOM element.

仅仅支持文档元素

Note: The first argument must be a DOM element, not a jQuery object or plain JavaScript object.

jQuery.each() :  A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function‘s arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.

jQuery.extend() : Merge the contents of two or more objects together into the first object.

第一个参数为ture时,执行深拷贝,target为第二个参数

jQuery.globalEval() : Execute some JavaScript code globally.

jQuery.grep() : Finds the elements of an array which satisfy a filter function. The original array is not affected.

类似于es5 的filter

jQuery.inArray() : Search for a specified value within an array and return its index (or -1 if not found).

jQuery.isArray() : returns a Boolean indicating whether the object is a JavaScript array (not an array-like object, such as a jQuery object)

jQuery.isEmptyObject(): Check to see if an object is empty (contains no enumerable properties).

jQuery.isPlainObject() : Check to see if an object is a plain object (created using "{}" or "new Object").

jQuery.makeArray() : Convert an array-like object into a true JavaScript array.

jQuery.map() : Translate all items in an array or object to new array of items.

类似于es5 map方法 ,区别1)返回null时,值不被包含在结果中2)映射函数返回的如果是数组,则该数组被添加到结果数组中,而不是数组本身中

jQuery.merge() :  Merge the contents of two arrays together into the first array.

jQuery.parseJSON() : Takes a well-formed JSON string and returns the resulting JavaScript value.

jQuery.proxy() : Takes a function and returns a new one that will always have a particular context.

类似于es5的bind,但它没有像bind()方法那样实现参数的部分应用。

jQuery.trim() : Remove the whitespace from the beginning and end of a string.

If these whitespace characters occur in the middle of the string, they are preserved

jQuery 工具函数

标签:merge   not   方法   contents   oge   rem   而不是   length   sea   

原文地址:https://www.cnblogs.com/goOtter/p/9534214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!