Commit graph

342 commits

Author SHA1 Message Date
jeresig 1d2b1a57da Added in jQuery.proxy(obj, name), like the method described in Secrets of the JavaScript Ninja and in Dojo's Hitch, and added in some unit tests. 2009-12-31 15:17:52 -05:00
jeresig a5dbca4a06 Moved jQuery.proxy() into core. 2009-12-31 15:06:45 -05:00
jeresig 6cb2945837 Rather than declaring empty anonymous functions all around, introduce and use a single empty function. Thanks to Matt Kruse for the suggestion. 2009-12-31 09:50:49 -05:00
jeresig 3776cbe314 Standardize on using double-quotes for string literals. 2009-12-21 20:13:16 -05:00
jeresig 61e37d4149 Made a number of spacing changes to bring the code more-inline with the jQuery Core Style Guideline. 2009-12-21 19:58:13 -05:00
jeresig 298bfb79e6 The constructor check for isPlainObject was redundant, everything still passes without it. 2009-12-18 19:43:04 -05:00
jeresig 67b3be24e1 Added additional checks for DOM nodes and window to isPlainObject, IE 8 was still letting those pass through. Fixes #5669. 2009-12-18 19:36:35 -05:00
jeresig d40083c866 Disabled the passthrough .attr(method_name) functionality. You can now use it if you do: .attr({method_name: value}, true) OR as an easy initialization method: jQuery('<div/>', {html: '...', id: 'test'}). 2009-12-18 12:41:53 -05:00
Robert Katic 148fb7ba8e Made isPlainObject() supporting null, undefined, and window values on IE too. Also added some related tests. Fixes #5669. 2009-12-19 01:19:34 +08:00
jeresig ed5731dcc4 Revert the changes from 65ebf57c1e, they were ineffectual against IE's insanity: http://ejohn.org/files/bugs/fragment/ Used a different tactic instead (just don't return a fragment from .parent()). Fixes #5638. 2009-12-17 14:17:05 -05:00
jeresig 9a0174b057 Moved readyList check. 2009-12-16 23:09:55 -05:00
jeresig 9997620420 Retooled the arguments.callee-related changes in 98ce35d52b to avoid re-declarations where possible. 2009-12-16 16:45:00 -05:00
John Resig 65ebf57c1e Make sure that dynamically-created elements don't have a parent. Fixes #5638. 2009-12-10 17:01:04 -08:00
John Resig 474d814076 Moved some methods around inbetween core.js and traversing.js. Core methods shouldn't rely upon other modules (e.g. the selector engine) wherever possible. 2009-12-10 09:25:25 -08:00
John Resig ede2f2c4f7 Made some minor formatting changes to the access function. 2009-12-10 09:07:19 -08:00
John Resig 715d1c5a30 Rewrote .merge() (faster and less obtuse now). Fixed #5610. 2009-12-09 21:43:20 -08:00
Yehuda Katz 1a4d1904ae Fix up whitespace and a couple of glitches. 2009-12-09 21:17:10 -08:00
John Resig 04524287d3 Switched jQuery() to represent jQuery([]) instead of jQuery(document). 2009-12-09 20:36:07 -08:00
John Resig 9d8bd161b6 Clarified the use of jQuery.browser and enforced jQuery.browser.firefox matching Firefox, after the discussion in 17791c9a3e. 2009-12-09 15:07:16 -08:00
John Resig 5e2163085c Make sure that document ready events, inside a document ready, are added to the queue rather than executing immediately. Fixes #5261. 2009-12-09 13:45:06 -08:00
John Resig 17791c9a3e Added in jQuery.browser.firefox, deprecated jQuery.browser.mozilla. 2009-12-08 22:52:32 -08:00
Dave Methvin d3dc2d1234 Get browser version rather than rendering engine version.
Don't recognize Chrome as Safari.
See results of different userAgent strings here:
http://spreadsheets.google.com/ccc?key=0Aj5JJFjq9rZDdHdxXzRLVnY0SzFpRTBOUDc4VmhzRVE
2009-12-09 14:43:18 +08:00
John Resig 98ce35d52b Removed uses of arguments.callee from jQuery. 2009-12-07 16:42:25 -08:00
John Resig 00a0abb751 Moved .ready() to core.js from event.js. 2009-12-07 16:34:55 -08:00
John Resig 62a34450c0 Added an extra function check to prevent crashes in Safari 2. Fixes #3039. 2009-12-06 20:20:49 -08:00
John Resig 19ad49e607 Use the isXML function from Sizzle. 2009-12-06 17:52:31 -08:00
John Resig 1fe9ff5482 Merge branch 'master' of git@github.com:jquery/jquery 2009-12-06 15:51:15 -08:00
John Resig 87ba780c69 Renamed isObjectLiteral to isPlainObject (makes more sense, per the suggestion of Michael Geary). 2009-12-06 17:11:51 -05:00
Dave Methvin abbd2f4c3c Fix regexp for $.trim so it doesn't whack embedded spaces. 2009-12-06 10:31:57 +08:00
Ben Alman 2b481b93cf Landing Ben Alman's patch to add nextUntil, prevUntil, and parentsUntil. Also adds some tests for prevAll and nextAll, and fixes an test edge case in parents. 2009-12-04 12:28:47 -05:00
jeresig ad4f28631a Make sure that a DOM node isn't getting passed through (as is the case in IE, it has a toString of [object Object]. 2009-12-02 14:59:19 -05:00
jeresig df6e02a4a7 Merge branch 'master' of github.com:jquery/jquery 2009-11-30 13:42:26 -05:00
jeresig 90ba57ce6d Fixed bug with singleTag matching in core.js. 2009-11-30 13:42:19 -05:00
Yehuda Katz 17955cacf4 Fixes $.trim for &nbsp; closes #4980 2009-11-30 10:22:18 -08:00
Robert Katic ac00fe5bbb Generic jQuery.merge and safer jQuery.makeArray(nodeList).
* Made jQuery.marge more generic supporting null and undefined values, and supporting array like objects as results. Fixes #5527.

* Made jQuery.makeArray(nodeList) more safer using jQuery.merge internally. Fixes #5528.

* Added a second "results" argument to jQuery.makeArray for internal usage to avoid intermediary arrays in init.
2009-11-26 00:56:49 +08:00
Robert Katic 93be758de9 Made jQuery.extend(true, ...) to extend recursively only 'object literal' values. 2009-11-12 21:59:47 +08:00
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
Brandon Aaron e73990a566 fix for #3688, setting type attribute on button causes IE to throw error 2009-03-17 22:27:25 +00:00
Brandon Aaron aabf635cfe using parseFloat for offset and position methods and removed num helper method 2009-03-17 21:07:11 +00:00
John Resig 26731d475b Backed out commit [6260], was causing too many problems. We'll have to bite the bullet and assume that the incoming result set has array methods. Un-fixes jQuery bug #4250. 2009-03-17 20:39:29 +00:00
Ariel Flesler ece001f139 jquery core: Fixed a typo in a comment, closes #4294. 2009-03-05 13:36:12 +00:00
John Resig f1f5cd9f6a Simplified the structure of the .css() and .attr() methods (reducing the number of calls). Need to optimize $.css/$.curCSS/$.attr still. Fixes #4269. 2009-02-28 20:23:48 +00:00
John Resig 58235cc38e Removed the need for the results set to have array methods. Resolves jQuery bug #4250. 2009-02-25 18:41:29 +00:00
John Resig f094c803de Made some changes to how .find() works, inlined the duplicate check - should change other methods to act similarly. Goes towards fixing #4240. 2009-02-25 18:29:18 +00:00
John Resig 4bbb70b4eb Simplified the isXML function, no need to use recursion. 2009-02-25 15:37:09 +00:00
John Resig 85e0945718 Cut down on some more function calls for jQuery(...). Everything points back to the same root jQuery(document) object now. Going towards ticket #4240. 2009-02-25 14:23:25 +00:00
John Resig 041fd5f2b5 Reduced the number of function calls required for .find() (single element root), optimized some calls to jQuery() as well. Goes towards fixing #4240. 2009-02-25 04:57:00 +00:00
John Resig cb3f842c88 Overhauled the .remove() and .empty() methods to be much more efficient. Fixes bug #4222. 2009-02-23 16:32:45 +00:00
John Resig a37ca9e905 Made sure that .remove now uses multiFilter. Fixes bug #4205. 2009-02-20 19:45:29 +00:00
John Resig 75a973da35 Made it so that appendTo, etc. return the inserted elements (thus using pushStack, as well). Fixes bugs #3966 and #4182. 2009-02-18 16:29:43 +00:00
John Resig 3e46bce751 A speedup for .remove() (which also speeds up .html()). Fixes #4178. 2009-02-18 02:40:55 +00:00