Commit Graph

129 Commits

Author SHA1 Message Date
Rick Waldron
27d099d471 Cleanup spacing in traversing.js. Fixes #10601 2011-10-27 15:35:09 -04:00
Dave Methvin
d920ac68fd Simplify the .closest(Array) code since we no longer use it internally.
It was previously used in liveHandler for delegated events, but is now baked in to events.js. The signature is a strange one since it returns an array of matches, *not* a chainable jQuery object. I've marked it as deprecated.

The code is simplified by two things: 1) We don't care about optimizing the duplicate selectors case, and 2) `.is()` now handles positional selectors by looking for set membership, which eliminates the workaround that was being applied here. See 70e2e32e0e for that commit.
2011-09-23 09:11:02 -04:00
Dave Methvin
70e2e32e0e Landing pull request 491. Fix #7322. Make .is() with a positional selector work like delegated event logic. Fixes #7322.
More Details:
 - https://github.com/jquery/jquery/pull/491
 - http://bugs.jquery.com/ticket/7322
2011-09-19 23:50:52 -04:00
gnarf
9a96af1d59 Quick improvement to the performace of .index() with no arguments - Adding a unit test for .index() of a node without a parent returns -1 2011-06-14 23:38:36 -05:00
John Resig
728a70c036 Make sure that forms and selects are added to a jQuery set correctly. Fixes #6912. 2011-04-17 10:51:24 -07:00
timmywil
a564a0b1ec Run order problem when running full test suite in Opera 11, removed failing test as it passed by itself and there are others just like it 2011-04-11 12:24:31 -04:00
timmywil
eb857e2b71 Fix unit tests in firefox 4 and opera 11, passing null or undefined to indexOf was throwing an error in those browsers 2011-04-11 11:54:55 -04:00
jeresig
909a6ff60a Merge branch 'bug_7369' of https://github.com/timmywil/jquery into timmywil-bug_7369 2011-04-10 16:48:02 -04:00
jeresig
523db95de2 Merge branch '2773_find_closest' of https://github.com/timmywil/jquery into timmywil-2773_find_closest
Conflicts:
	test/unit/traversing.js
2011-04-10 16:37:09 -04:00
jeresig
52f31054fd Fix formatting. 2011-04-10 16:32:40 -04:00
timmywil
a807451a23 Fixes #7369 - Using an attribute selector for a non-existent attribute raised an exception on disconnected nodes 2011-03-30 23:39:19 -04:00
timmywil
1a16776730 Remove test for bug #7369 to move the fix to a separate branch for a sooner pull 2011-03-30 23:23:38 -04:00
timmywil
e09d8898d8 Add node and jQuery object support to $.fn.closest 2011-03-21 20:59:20 -04:00
timmywil
929792834f Organizing vars 2011-03-16 14:41:26 -04:00
timmywil
7a69e34a5c 2773: first pass adding node/jQuery object support to jQuery.fn.find; unit tests added 2011-03-16 01:16:32 -04:00
timmywil
9e5ec378e3 Merge branch 'master' of git://github.com/jquery/jquery into bug_2773 2011-02-26 18:53:25 -05:00
Anton M
6b08d88d04 Fix some whitespace issues. 2011-02-15 22:09:09 +01:00
Timmy Willison
ed48787ec5 Fix bug #2773, jQuery.fn.is to accept JQuery and node objects, and a small fix for winnow getting an undefined selector 2011-01-24 16:18:19 -05:00
John Resig
2e2d5e9db5 Merge branch 'fix-7853-add-context' of https://github.com/dmethvin/jquery into dmethvin-fix-7853-add-context 2011-01-20 14:51:30 -05:00
adam j. sontag
d9660e1bf4 Fix tabs vs spaces in initial workaround commit 2011-01-17 17:20:37 -05:00
adam j. sontag
78be517727 shorten the SHA 2011-01-17 17:08:44 -05:00
adam j. sontag
4058881784 Add link to chrome issue ticket 2011-01-17 17:03:45 -05:00
adam j. sontag
28a1bad7b1 Add a comment to explain (and enforce the temporary-ness of) an extra line of code added to workaround a Chrome 10 bug 2011-01-17 16:10:14 -05:00
jeresig
a7ab491a5d Merge branch 'master' of https://github.com/scottgonzalez/jquery 2011-01-14 11:23:05 -05:00
wycats
52a02383fa Fix a strange Chrome issue 2011-01-14 11:21:45 -05:00
Scott González
e5ee89ec9a Avoid running jQuery.unique() for methods that are guaranteed to produce a unique result set. Fixes #7964 - Some traversal methods perform an unnecessary uniqueness check. 2011-01-14 09:55:40 -05:00
Colin Snover
3e0cc81504 Clean trailing whitespace from all files. 2010-12-30 00:34:48 -06:00
Dave Methvin
c27d5ca6f5 By default, use document root rather than current selection's context when add()ing elements. Fixes #7853. 2010-12-28 21:07:04 -05:00
John Resig
fb48ae8e6c Make sure that when multiple variables are being declared that assignments are each done on their own line. 2010-11-09 11:09:07 -05:00
John Resig
478fa8fdb3 Forgot to remove the child selector in the previous commit. 2010-10-12 10:56:02 -04:00
John Resig
085de84959 The child selector-prefix branch doesn't work with selectors that have a larger depth. Removing for now - will need to re-evaluate in the future. 2010-10-12 10:13:00 -04:00
John Resig
5200194f51 Make sure that .find() with multiple direct child selectors is handled correctly. Fixes #7144. 2010-10-12 09:19:49 -04:00
John Resig
385ca2aa89 Make sure closest works on disconnected DOM nodes. Fixes #7142. 2010-10-11 07:45:15 -04:00
jeresig
fac7e61f16 Tweaking some formatting of the closest changes. 2010-10-10 15:42:56 -04:00
jeresig
ba149e78a9 Switch back to using Sizzle.matchesSelector. 2010-10-10 15:36:02 -04:00
jeresig
eb67d99416 Use the new Sizzle matches functionality. 2010-10-10 15:14:23 -04:00
jeresig
6f0b06aa9b Fix formatting and switch to using the new matchesSelector method in Sizzle. 2010-10-10 13:37:36 -04:00
wycats
0ca35de311 Should improve performance of closest considerably. Benchmark proof in speed/closest.html 2010-10-09 21:33:02 -07:00
John Resig
f1f6bc3ec4 Handle child selectors in particular - away from the selector engine. Fixes #7029. 2010-09-28 10:33:21 -07:00
jeresig
7be11207b9 Removing unique check on closest(Array) (it wasn't appropriate there and broke functionality elsewhere) - follow-up to commit 8c41325a08. Also added another test for closest(Array) after a discussion with @jitter in 26b0e913dd. 2010-09-27 20:59:42 -04:00
jeresig
8c41325a08 Merge branch 'closestbug-6700' of http://github.com/ajpiano/jquery into ajpiano-closestbug-6700 2010-09-27 15:45:02 -04:00
jeresig
bca5765502 Make sure that jQuery works even when the individual modules are loaded separately AND jQuery.noConflict(true) is used. Fixes #7011. 2010-09-08 13:54:33 -04:00
adam j. sontag
a2bd8a53f3 .closest() should return a unique set of elements, not duplicates of the same ancestor. Fixes #6700 2010-06-21 14:18:06 -04:00
jeresig
4a64f9a5b8 Removed extra semicolon leftover from recent tweaking. 2010-03-31 14:36:24 -04:00
jeresig
8effe3a7de Made it so that you no longer need to build jQuery in order to run the test suite (but you'll still need a checkout of QUnit and Sizzle, at least). 2010-03-23 12:12:16 -04:00
jeresig
dcf0fa5048 More changes to get jQuery in line with JSLint. 2010-03-01 21:24:49 -05:00
jeresig
a4043cdcbf Land some additional tweaks related to running through JSLint. 2010-03-01 18:19:29 -05:00
jeresig
26b0e913dd Make sure that live events bubble unless explicitly told not to, like a normal event. Fixes #6182. 2010-02-26 09:26:14 -05:00
Robert Katic
55a64cf095 Filtering elements only. Fixed #5920 2010-01-26 07:51:44 +08:00
Ben Alman
28ce15979f fixed jQuery.dir regression introduced with 1.4 *untils patch that errored when traversing XHTML text nodes with an until test 2010-01-24 01:20:53 +08:00
jeresig
5d49335eac Make sure that disconnected nodes aren't sorted/uniqued. Fixes #5791. 2010-01-13 00:12:18 -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
9368b188c0 Removed jQuery.fn.contains - didn't match the :contains() selector and confused things. Thanks ajpiano for the tip. 2009-12-18 10:54:34 -05: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
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
88572ee692 Make sure that the correct args are passed in to the filter callback (and by extension, the not callback). Fixes #5594. 2009-12-09 22:03:14 -08:00
Yehuda Katz
4e27f17007 Landing in jQuery.contains, jQuery.fn.contains, and jQuery.fn.has support. Fixes #4101. 2009-12-09 12:43:13 -08:00
jeresig
39a77c2d02 Switched to using slice instead of join to get the correct results. 2009-12-04 12:36:24 -05: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
c6a0211e57 Minor syntax changes to the winnow function. 2009-12-03 14:20:06 -05:00
jeresig
24e96ba22c Re-worked the closest no-duplicate-selector code again to be more efficient. 2009-12-03 11:14:10 -05:00
jeresig
525bb27bc0 Prevent duplicate selectors from having to match in closest. 2009-12-03 11:05:12 -05:00
jeresig
4daae7a79f No need to do the closest match if no selectors are passed in. 2009-12-03 10:51:04 -05:00
jeresig
e534a310c7 Added in the new .closest(Array) method, will be used to improve the performance of live filtering. 2009-12-02 19:05:51 -05:00
Karl Swedberg
255068da33 added missing semicolons 2009-11-28 04:09:14 +08:00
Karl Swedberg
ddb86f8d5b added curly braces around all if/else statements 2009-11-28 04:09:14 +08:00
Robert Katić
e03aee1aa6 Made the closest method evaluate the selector with appropriate context. 2009-11-09 12:39:29 +01:00
John Resig
76f6f0d39d Fixing spacing problems from rkatic's patches. 2009-11-07 17:40:47 +01:00
rkatic
0f03c7489f Store last closer value to jQuery.lastCloser instead of using data API. 2009-11-08 00:36:44 +08:00
John Resig
b0fe380cf8 Make .add() take an optional context and - if a context is specified in the root selector - use that as the base context. 2009-11-07 16:43:31 +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
Yehuda Katz
9b20eb4c85 Make jQuery.winnow a local function 2009-09-15 00:35:35 +00:00
John Resig
9de120e6d7 Added support for .eq(-N), .first(), and .last(). Fixes #2164 and #4188. 2009-09-09 00:21:21 +00:00
John Resig
d6991fa273 Added support for .closest(filter, DOMElement). Fixes #4072. 2009-07-28 12:28:59 +00:00
John Resig
61b18c866c Backing out commit #6507 - causes too many problems. 2009-07-28 12:22:10 +00:00
John Resig
cae93c39eb Implemented support for .context limited .closest() calls. Fixes #4072. 2009-07-25 21:31:59 +00:00
Yehuda Katz
87869b8b81 Unify .not and .filter (resolves #4200).
- Both now support Function, Element, Selector, and Arrayish (including jQuery object)
2009-07-16 07:32:11 +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