Commit graph

256 commits

Author SHA1 Message Date
Robert Katic 990d9ca1b0 Made isObjectLiteral to work correctly with custom objects with empty prototypes. 2009-11-12 21:59:47 +08:00
lrbabe c07d15d5a2 Use array.indexOf if available (speeds up modern browsers). Thanks to lrbabe and Andrea for the patch. Fixes #5160. 2009-11-11 15:15:58 -05:00
John Resig c4c820efff Made jQuery('<div/>') and jQuery('<div></div>') use the same code path (making the second one faster). Fixes #5293. 2009-11-11 13:49:29 -05:00
John Resig dee8e45ef3 Removed the use of this.length++ as it makes it hard to use the init method directly. Fixes #4955. 2009-11-11 13:42:50 -05:00
John Resig 4b55e94d08 Renamed isObject to isObjectLiteral to be more specific. 2009-11-10 23:07:05 -05:00
rkatic c2bbcd8833 Added comments to isObject. 2009-11-09 19:32:24 +08:00
John Resig ef05f44cce Comment nodes are discarded from a merge, for no apparent reason. Fixes #5438. 2009-11-07 16:15:33 +01:00
John Resig bbffc99f7c Moved a bunch of methods out of the jQuery-specific Sizzle code into more-appropriate files, in jQuery itself. 2009-10-26 18:07:57 -04:00
John Resig 67d445a703 A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)

$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)

$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)

$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)

Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().

Exception: .parents() will still return the results in reverse document order.

jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
Ariel Flesler 66c58e9db6 jquery core: removing the body optimization, as it is then handled by $("TAG"). 2009-09-14 17:33:15 +00:00
Ariel Flesler 9e1a955aab jquery core: commenting the new access function. 2009-09-11 17:47:40 +00:00
Ariel Flesler d1285504fb jquery core: Closes #5189. Added a generic function to handle getting/setting key-value/setting a hash. 2009-09-09 21:14:28 +00:00
Ariel Flesler aadc268abf jquery core: fixes 5187. getElementsByTagName optimization was breaking $('div').live() 2009-09-09 16:50:58 +00:00
Ariel Flesler bf230ffb6a jquery core: closes #5186. getElementsByTagName optimization was breaking the selector attribute. 2009-09-09 16:33:16 +00:00
John Resig 4ea4fad090 Optimize jQuery() for the case $("TAG"). 2009-09-08 04:26:47 +00:00
John Resig 1e750a00e9 Use the native Array indexOf method if it exists, for jQuery.inArray. 2009-09-08 01:45:11 +00:00
John Resig 9d8d74569c Split out the fragment-building code from domManip. Switched core.js to using that instead. Also moved the standalone tag detection to $(...) for performance. 2009-09-07 18:58:01 +00:00
John Resig b7d4e0e46c Added an optimization for the case where $("body") is used. 2009-09-07 17:20:38 +00:00
John Resig 569c8b45c0 Fixed a bug with the isXMLDoc test - also made sure that isXMLDoc was handling the case where documentElement is undefined (which only occurs on HTML documents in IE). 2009-08-27 20:07:45 +00:00
John Resig 957cd6fb2a Tweaked the isXMLDoc iframe test case to test the document, not the body element (which doesn't exist in IE). Also made the isXMLDoc code handle cases where elem is null, undefined, etc. 2009-08-27 19:22:48 +00:00
John Resig bddd1837bb Moved exposing window.jQuery and window.$ to the end of the jQuery file (helps some compatibility cases with older version of Prototype). Fixes ticket #4834. 2009-08-10 21:22:31 +00:00
John Resig b7a3b220a8 Fix some missing braces in core.js. 2009-07-27 20:48:42 +00:00
John Resig 18a6fbbb6a Added an improvement to quickExpr and some more tests for jQuery('html'). Fixes #4979. 2009-07-27 20:47:32 +00:00
John Resig 255a293cda Shortened the isXMLDoc code, based upon recommendation from Andrea. 2009-07-27 13:21:19 +00:00
John Resig 2cd9ee3510 Added an extra documentElement check to isXMLDoc for IE - and added a number of unit tests for isXMLDoc. Fixes #4833. 2009-07-27 13:02:41 +00:00
John Resig 26eda09892 Changed .get(-Number) to use .slice() instead of .toArray() (which doesn't take any arguments). Follow-up from commit [6484]. 2009-07-23 22:38:29 +00:00
John Resig 0a6c5205d2 Make sure that at least one argument is provided to .slice(), in accordance with the spec. Fixes jQuery bug #4942. 2009-07-23 13:22:55 +00:00
John Resig b964e56946 Optimizing isXMLDoc. 2009-07-22 17:30:17 +00:00
John Resig 29ff710c9b Made some syntax tweaks to core.js. 2009-07-19 19:55:21 +00:00
John Resig b953c1d50a Saved some references to native methods, instead of re-referencing them on every call. 2009-07-19 19:50:45 +00:00
John Resig 03de2cb5e7 Moved some RegExp in core.js, goes toward #4111. 2009-07-19 19:47:30 +00:00
John Resig 0d5c3a68a0 Standardizing on .test() and .exec() - moving away from using .match() for RegExp. Fixes jQuery bug #4113. 2009-07-19 13:21:51 +00:00
Yehuda Katz 1a7f72e7fe Add test for jQuery(jQueryObj) cloning and simplify new get() code 2009-07-17 17:33:44 +00:00
Yehuda Katz 88bd74c732 jQuery objects have a default length of 0. Simplifies $() some. 2009-07-17 01:47:26 +00:00
Ariel Flesler a38a5cd531 jquery core: Simplifying isEmptyObject() and adding tests. 2009-07-16 15:16:44 +00:00
Yehuda Katz 190812c3be Refactor jQuery.data a bit to reduce property lookups
- Also added jQuery.isEmptyObject
2009-07-16 07:32:31 +00:00
Yehuda Katz c10f87120f jQuery.extend(true, Object, Object) copies custom objects correctly.
- Also update jQuery.isObject to handle this case correctly
2009-07-16 07:32:03 +00:00
Yehuda Katz 8d52c27808 jQuery.extend(true, Object, Object) copies objects with length keys correctly 2009-07-16 07:31:55 +00:00
Yehuda Katz e532dfe522 Add support for .get(-Number) Closes #4188 2009-07-16 07:31:41 +00:00
Yehuda Katz e124fec5e9 Make toArray an alias for .get(). Closes #3999 2009-07-16 07:31:32 +00:00
John Resig c5315f6687 Scope 'document' locally (also useful for sandboxing). Patch from Andrea Giammarchi. Fixes bug #4905. 2009-07-15 12:35:57 +00:00
John Resig fd2a2fed84 Optimized jQuery(Element) to not call jQuery() twice. 2009-07-11 13:44:44 +00:00
Ariel Flesler c6b9654ea8 jquery core: Closes #2827. jQuery.each iterates over functions 2009-06-20 15:51:19 +00:00
John Resig a0451f162e Did some light reordering of the jQuery definition. Moved window and undefined to exist in intro/outro. 2009-05-20 21:12:08 +00:00
Ariel Flesler 3a80de1c7a jquery core: $() -> $(document) and $(undefined) -> $([]). Removed a duplicated block. 2009-05-03 15:57:25 +00:00
Brandon Aaron ffd457d456 index now works in reverse when passed a selector or undefined. fixes #3971 2009-05-02 19:22:55 +00:00
John Resig 2764127335 Unified the formatting of core.js. === or !== are used wherever appropriate, syntax has been normalized, braces are added in all cases, and jQuery() now returns an empty set. 2009-03-31 17:35:20 +00:00
Brandon Aaron f8ef75eb91 remove trailing spaces 2009-03-23 01:55:17 +00:00
Brandon Aaron 7c04a64016 breaking jquery out into smaller modules. added attributes.js, manipulation.js, and traversing.js 2009-03-18 21:15:38 +00:00
Brandon Aaron ace13387c8 fix for #4074, pass context to jQuery.clean for jQuery.clone 2009-03-18 02:48:32 +00:00