Selector: Inline Sizzle into the selector module

This commit removes Sizzle from jQuery, inlining its code & removing obsolete
workarounds where applicable.

The selector-native module has been removed. Further work on the selector
module may decrease the size enough that it will no longer be necessary. If
it turns out it's still useful, we'll reinstate it but the code will look
different anyway as we'll want to share as much code as possible with
the existing selector module.

The Sizzle AUTHORS.txt file has been merged with the jQuery one - people are
sorted by their first contributions to either of the two repositories.

The commit reduces the gzipped jQuery size by 1460 bytes compared to master.

Closes gh-4395
This commit is contained in:
Michał Gołębiowski-Owczarek 2019-07-29 21:14:46 +02:00
parent 79b74e043a
commit 47835965bd
41 changed files with 2178 additions and 2969 deletions

View File

@ -4,6 +4,8 @@ Alexander Farkas <info@corrupt-system.de>
Alexander Farkas <info@corrupt-system.de> <a.farkas.pm@googlemail.com>
Alexis Abril <me@alexisabril.com> <alexis.abril@gmail.com>
Andrew E Monat <amonat@gmail.com>
Andrey Meshkov <ay.meshkov@gmail.com>
Andrey Meshkov <ay.meshkov@gmail.com> <am@adguard.com>
Anton Matzneller <obhvsbypqghgc@gmail.com>
Anton Matzneller <obhvsbypqghgc@gmail.com> <haskell_noob-github@yahoo.de>
Batiste Bieler <batiste.bieler@gmail.com>
@ -13,6 +15,8 @@ Carl Danley <carldanley@gmail.com>
Carl Fürstenberg <azatoth@gmail.com>
Carl Fürstenberg <azatoth@gmail.com> <carl@excito.com>
Charles McNulty <cmcnulty@kznf.com>
Chris Rebert <github@rebertia.com>
Chris Rebert <github@rebertia.com> <code@rebertia.com>
Christopher Jones <chris@cjqed.com> cjqed <christopherjonesqed@gmail.com>
Colin Snover <github.com@zetafleet.com> <colin@alpha.zetafleet.com>
Corey Frang <gnarf37@gmail.com> <gnarf@gnarf.net>
@ -52,6 +56,8 @@ Josh Varner <josh.varner@gmail.com> <josh.varner@gmail.com>
Julian Aubourg <aubourg.julian@gmail.com>
Julian Aubourg <aubourg.julian@gmail.com> <j@ubourg.net>
Julian Aubourg <aubourg.julian@gmail.com> <Julian@.(none)>
John Firebaugh <john_firebaugh@bigfix.com>
John Firebaugh <john_firebaugh@bigfix.com> <john_firebaugh@us.ibm.com>
Jörn Zaefferer <joern.zaefferer@gmail.com>
Jörn Zaefferer <joern.zaefferer@gmail.com> <joern.zaefferer@googlemail.com>
Jörn Zaefferer <joern.zaefferer@gmail.com> <JZA@.(none)>

View File

@ -20,16 +20,24 @@ David Serduke <davidserduke@gmail.com>
Richard D. Worth <rdworth@gmail.com>
Scott González <scott.gonzalez@gmail.com>
Ariel Flesler <aflesler@gmail.com>
Cheah Chu Yeow <chuyeow@gmail.com>
Andrew Chalkley <andrew@chalkley.org>
Fabio Buffoni <fabio.buffoni@bitmaster.it>
Stefan Bauckmeier  <stefan@bauckmeier.de>
Jon Evans <jon@springyweb.com>
TJ Holowaychuk <tj@vision-media.ca>
Riccardo De Agostini <rdeago@gmail.com>
Michael Bensoussan <mickey@seesmic.com>
Robert Katić <robert.katic@gmail.com>
Louis-Rémi Babé <lrbabe@gmail.com>
Earle Castledine <mrspeaker@gmail.com>
Robert Katić <robert.katic@gmail.com>
Damian Janowski <damian.janowski@gmail.com>
Anton Kovalyov <anton@kovalyov.net>
Dušan B. Jovanovic <dbjdbj@gmail.com>
Earle Castledine <mrspeaker@gmail.com>
Rich Dougherty <rich@rd.gen.nz>
Kim Dalsgaard <kim@kimdalsgaard.com>
Andrea Giammarchi <andrea.giammarchi@gmail.com>
Fabian Jakobs <fabian.jakobs@web.de>
Mark Gibson <jollytoad@gmail.com>
Karl Swedberg <kswedberg@gmail.com>
Justin Meyer <justinbmeyer@gmail.com>
@ -37,9 +45,10 @@ Ben Alman <cowboy@rj3.net>
James Padolsey <cla@padolsey.net>
David Petersen <public@petersendidit.com>
Batiste Bieler <batiste.bieler@gmail.com>
Jake Archibald <jake.archibald@bbc.co.uk>
Alexander Farkas <info@corrupt-system.de>
Rick Waldron <waldron.rick@gmail.com>
Filipe Fortes <filipe@fortes.com>
Rick Waldron <waldron.rick@gmail.com>
Neeraj Singh <neerajdotname@gmail.com>
Paul Irish <paul.irish@gmail.com>
Iraê Carvalho <irae@irae.pro.br>
@ -47,23 +56,24 @@ Matt Curry <matt@pseudocoder.com>
Michael Monteleone <michael@michaelmonteleone.net>
Noah Sloan <noah.sloan@gmail.com>
Tom Viner <github@viner.tv>
J. Ryan Stinnett <jryans@gmail.com>
Douglas Neiner <doug@dougneiner.com>
Adam J. Sontag <ajpiano@ajpiano.com>
Heungsub Lee <h@subl.ee>
Dave Reed <dareed@microsoft.com>
Ralph Whitbeck <ralph.whitbeck@gmail.com>
Carl Fürstenberg <azatoth@gmail.com>
Jacob Wright <jacwright@gmail.com>
J. Ryan Stinnett <jryans@gmail.com>
Ralph Whitbeck <ralph.whitbeck@gmail.com>
unknown <Igen005@.upcorp.ad.uprr.com>
temp01 <temp01irc@gmail.com>
Heungsub Lee <h@subl.ee>
Colin Snover <github.com@zetafleet.com>
Jared Grippe <jared@deadlyicon.com>
Ryan W Tenney <ryan@10e.us>
Alex Sexton <AlexSexton@gmail.com>
Pinhook <contact@pinhooklabs.com>
Ron Otten <r.j.g.otten@gmail.com>
Jephte Clain <Jephte.Clain@univ-reunion.fr>
Anton Matzneller <obhvsbypqghgc@gmail.com>
Alex Sexton <AlexSexton@gmail.com>
Dan Heberden <danheberden@gmail.com>
Henri Wiechers <hwiechers@gmail.com>
Russell Holbrook <russell.holbrook@patch.com>
@ -73,21 +83,19 @@ Scott Jehl <scottjehl@gmail.com>
James Burke <jrburke@gmail.com>
Jonas Pfenniger <jonas@pfenniger.name>
Xavi Ramirez <xavi.rmz@gmail.com>
Jared Grippe <jared@deadlyicon.com>
Sylvester Keil <sylvester@keil.or.at>
Brandon Sterne <bsterne@mozilla.com>
Mathias Bynens <mathias@qiwi.be>
Lee Carpenter <elcarpie@gmail.com>
Timmy Willison <4timmywil@gmail.com>
Corey Frang <gnarf37@gmail.com>
Digitalxero <digitalxero>
Anton Kovalyov <anton@kovalyov.net>
David Murdoch <david@davidmurdoch.com>
Josh Varner <josh.varner@gmail.com>
Charles McNulty <cmcnulty@kznf.com>
Jordan Boesch <jboesch26@gmail.com>
Jess Thrysoee <jess@thrysoee.dk>
Michael Murray <m@murz.net>
Lee Carpenter <elcarpie@gmail.com>
Alexis Abril <me@alexisabril.com>
Rob Morgan <robbym@gmail.com>
John Firebaugh <john_firebaugh@bigfix.com>
@ -107,12 +115,13 @@ Timo Tijhof <krinklemail@gmail.com>
Steen Nielsen <swinedk@gmail.com>
Anton Ryzhov <anton@ryzhov.me>
Shi Chuan <shichuanr@gmail.com>
Matt Mueller <mattmuelle@gmail.com>
Berker Peksag <berker.peksag@gmail.com>
Toby Brain <tobyb@freshview.com>
Matt Mueller <mattmuelle@gmail.com>
Justin <drakefjustin@gmail.com>
Daniel Herman <daniel.c.herman@gmail.com>
Oleg Gaidarenko <markelog@gmail.com>
Rock Hymas <rock@fogcreek.com>
Richard Gibson <richard.gibson@gmail.com>
Rafaël Blais Masson <rafbmasson@gmail.com>
cmc3cn <59194618@qq.com>
@ -124,6 +133,7 @@ Andrew E Monat <amonat@gmail.com>
Oskari <admin@o-programs.com>
Joao Henrique de Andrade Bruni <joaohbruni@yahoo.com.br>
tsinha <tsinha@Anthonys-MacBook-Pro.local>
Dominik D. Geyer <dominik.geyer@gmail.com>
Matt Farmer <matt@frmr.me>
Trey Hunner <treyhunner@gmail.com>
Jason Moon <jmoon@socialcast.com>
@ -132,164 +142,180 @@ Kris Borchers <kris.borchers@gmail.com>
Vladimir Zhuravlev <private.face@gmail.com>
Jacob Thornton <jacobthornton@gmail.com>
Chad Killingsworth <chadkillingsworth@missouristate.edu>
Vitya Muhachev <vic99999@yandex.ru>
Nowres Rafid <nowres.rafed@gmail.com>
David Benjamin <davidben@mit.edu>
Alan Plum <github@ap.apsq.de>
Uri Gilad <antishok@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Marcel Greter <marcel.greter@ocbnet.ch>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@gmail.com>
Daniel Gálvez <dgalvez@editablething.com>
Nikita Govorov <nikita.govorov@gmail.com>
Wesley Walser <waw325@gmail.com>
Mike Pennisi <mike@mikepennisi.com>
Matthias Jäggli <matthias.jaeggli@gmail.com>
Devin Cooper <cooper.semantics@gmail.com>
Markus Staab <markus.staab@redaxo.de>
Dave Riddle <david@joyvuu.com>
Callum Macrae <callum@lynxphp.com>
Jonathan Sampson <jjdsampson@gmail.com>
Benjamin Truyman <bentruyman@gmail.com>
Jay Merrifield <fracmak@gmail.com>
James Huston <james@jameshuston.net>
Sai Lung Wong <sai.wong@huffingtonpost.com>
Erick Ruiz de Chávez <erickrdch@gmail.com>
David Bonner <dbonner@cogolabs.com>
Allen J Schmidt Jr <cobrasoft@gmail.com>
Akintayo Akinwunmi <aakinwunmi@judge.com>
MORGAN <morgan@morgangraphics.com>
Ismail Khair <ismail.khair@gmail.com>
Carl Danley <carldanley@gmail.com>
Mike Petrovich <michael.c.petrovich@gmail.com>
Greg Lavallee <greglavallee@wapolabs.com>
Daniel Gálvez <dgalvez@editablething.com>
Sai Lung Wong <sai.wong@huffingtonpost.com>
Tom H Fuertes <TomFuertes@gmail.com>
Roland Eckl <eckl.roland@googlemail.com>
Jay Merrifield <fracmak@gmail.com>
Allen J Schmidt Jr <cobrasoft@gmail.com>
Jonathan Sampson <jjdsampson@gmail.com>
Marcel Greter <marcel.greter@ocbnet.ch>
Matthias Jäggli <matthias.jaeggli@gmail.com>
David Fox <dfoxinator@gmail.com>
Yiming He <yiminghe@gmail.com>
Devin Cooper <cooper.semantics@gmail.com>
David Fox <dfoxinator@gmail.com>
Bennett Sorbo <bsorbo@gmail.com>
Paul Ramos <paul.b.ramos@gmail.com>
Rod Vagg <rod@vagg.org>
Bennett Sorbo <bsorbo@gmail.com>
Sebastian Burkhard <sebi.burkhard@gmail.com>
Zachary Adam Kaplan <razic@viralkitty.com>
Adam Coulombe <me@adam.co>
nanto_vi <nanto@moon.email.ne.jp>
nanto <nanto@moon.email.ne.jp>
Danil Somsikov <danilasomsikov@gmail.com>
Ryunosuke SATO <tricknotes.rs@gmail.com>
Diego Tres <diegotres@gmail.com>
Jean Boussier <jean.boussier@gmail.com>
Adam Coulombe <me@adam.co>
Andrew Plummer <plummer.andrew@gmail.com>
Mark Raddatz <mraddatz@gmail.com>
Pascal Borreli <pascal@borreli.com>
Isaac Z. Schlueter <i@izs.me>
Karl Sieburg <ksieburg@yahoo.com>
Pascal Borreli <pascal@borreli.com>
Nguyen Phuc Lam <ruado1987@gmail.com>
Dmitry Gusev <dmitry.gusev@gmail.com>
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Li Xudong <istonelee@gmail.com>
Steven Benner <admin@stevenbenner.com>
Tom H Fuertes <tomfuertes@gmail.com>
Li Xudong <istonelee@gmail.com>
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
Frederic Junod <frederic.junod@camptocamp.com>
Tom H Fuertes <tomfuertes@gmail.com>
Mitch Foley <mitch@thefoley.net>
ros3cin <ros3@cin.ufpe.br>
Jason Bedard <jason+jquery@jbedard.ca>
Kyle Robinson Young <kyle@dontkry.com>
John Paul <john@johnkpaul.com>
Jason Bedard <jason+jquery@jbedard.ca>
Chris Talkington <chris@talkingtontech.com>
Eddie Monge <eddie@eddiemonge.com>
Terry Jones <terry@jon.es>
Jason Merino <jasonmerino@gmail.com>
Dan Burzo <danburzo@gmail.com>
Jeremy Dunck <jdunck@gmail.com>
Chris Price <price.c@gmail.com>
Guy Bedford <guybedford@gmail.com>
njhamann <njhamann@gmail.com>
Goare Mao <mygoare@gmail.com>
Amey Sakhadeo <me@ameyms.com>
Mike Sidorov <mikes.ekb@gmail.com>
Anthony Ryan <anthonyryan1@gmail.com>
Dominik D. Geyer <dominik.geyer@gmail.com>
George Kats <katsgeorgeek@gmail.com>
Lihan Li <frankieteardrop@gmail.com>
George Kats <katsgeorgeek@gmail.com>
Dongseok Paeng <dongseok83.paeng@lge.com>
Ronny Springer <springer.ronny@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com>
Marian Sollmann <marian.sollmann@cargomedia.ch>
njhamann <njhamann@gmail.com>
Ilya Kantor <iliakan@gmail.com>
Marian Sollmann <marian.sollmann@cargomedia.ch>
Chris Antaki <ChrisAntaki@gmail.com>
David Hong <d.hong@me.com>
John Paul <john@johnkpaul.com>
Jakob Stoeck <jakob@pokermania.de>
Christopher Jones <chris@cjqed.com>
Forbes Lindesay <forbes@lindesay.co.uk>
S. Andrew Sheppard <andrew@wq.io>
Leonardo Balter <leonardo.balter@gmail.com>
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
Daniel Husar <dano.husar@gmail.com>
Philip Jägenstedt <philip@foolip.org>
John Hoven <hovenj@gmail.com>
Roman Reiß <me@silverwind.io>
Benjy Cui <benjytrys@gmail.com>
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
John Hoven <hovenj@gmail.com>
Philip Jägenstedt <philip@foolip.org>
Christian Kosmowski <ksmwsk@gmail.com>
David Corbacho <davidcorbacho@gmail.com>
Liang Peng <poppinlp@gmail.com>
TJ VanToll <tj.vantoll@gmail.com>
Senya Pugach <upisfree@outlook.com>
Aurelio De Rosa <aurelioderosa@gmail.com>
Senya Pugach <upisfree@outlook.com>
Dan Hart <danhart@notonthehighstreet.com>
Nazar Mokrynskyi <nazar@mokrynskyi.com>
Benjamin Tan <demoneaux@gmail.com>
Amit Merchant <bullredeyes@gmail.com>
Jason Bedard <jason+github@jbedard.ca>
Arthur Verschaeve <contact@arthurverschaeve.be>
Dan Hart <danhart@notonthehighstreet.com>
Bin Xin <rhyzix@gmail.com>
David Corbacho <davidcorbacho@gmail.com>
Veaceslav Grimalschi <grimalschi@yandex.ru>
Daniel Husar <dano.husar@gmail.com>
Frederic Hemberger <mail@frederic-hemberger.de>
Ben Toews <mastahyeti@gmail.com>
Aditya Raghavan <araghavan3@gmail.com>
Victor Homyakov <vkhomyackov@gmail.com>
Richard McDaniel <rm0026@uah.edu>
Arthur Verschaeve <contact@arthurverschaeve.be>
Shivaji Varma <contact@shivajivarma.com>
Ben Toews <mastahyeti@gmail.com>
Bin Xin <rhyzix@gmail.com>
Neftaly Hernandez <neftaly.hernandez@gmail.com>
T.J. Crowder <tj.crowder@farsightsoftware.com>
Nicolas HENRY <icewil@gmail.com>
Frederic Hemberger <mail@frederic-hemberger.de>
Victor Homyakov <vkhomyackov@gmail.com>
Aditya Raghavan <araghavan3@gmail.com>
Anne-Gaelle Colom <coloma@westminster.ac.uk>
George Mauer <gmauer@gmail.com>
Leonardo Braga <leonardo.braga@gmail.com>
George Mauer <gmauer@gmail.com>
Stephen Edgar <stephen@netweb.com.au>
Thomas Tortorini <thomastortorini@gmail.com>
Winston Howes <winstonhowes@gmail.com>
Jörn Wagner <joern.wagner@explicatis.com>
Jon Hester <jon.d.hester@gmail.com>
Colin Frick <colin@bash.li>
Winston Howes <winstonhowes@gmail.com>
Alexander O'Mara <me@alexomara.com>
Bastian Buchholz <buchholz.bastian@googlemail.com>
Arthur Stolyar <nekr.fabula@gmail.com>
Calvin Metcalf <calvin.metcalf@gmail.com>
Mu Haibao <mhbseal@163.com>
Richard McDaniel <rm0026@uah.edu>
Chris Rebert <github@rebertia.com>
Bastian Buchholz <buchholz.bastian@googlemail.com>
Mu Haibao <mhbseal@163.com>
Calvin Metcalf <calvin.metcalf@gmail.com>
Arthur Stolyar <nekr.fabula@gmail.com>
Gabriel Schulhof <gabriel.schulhof@intel.com>
Gilad Peleg <giladp007@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
Martin Naumann <martin@geekonaut.de>
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
John-David Dalton <john.david.dalton@gmail.com>
Marek Lewandowski <m.lewandowski@cksource.com>
Bruno Pérel <brunoperel@gmail.com>
Reed Loden <reed@reedloden.com>
Daniel Nill <daniellnill@gmail.com>
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
Reed Loden <reed@reedloden.com>
Sean Henderson <seanh.za@gmail.com>
Gary Ye <garysye@gmail.com>
Richard Kraaijenhagen <stdin+git@riichard.com>
Connor Atherton <c.liam.atherton@gmail.com>
Gary Ye <garysye@gmail.com>
Christian Grete <webmaster@christiangrete.com>
Tom von Clef <thomas.vonclef@gmail.com>
Liza Ramo <liza.h.ramo@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Joelle Fleurantin <joasqueeniebee@gmail.com>
Jae Sung Park <alberto.park@gmail.com>
Jun Sun <klsforever@gmail.com>
Josh Soref <apache@soref.com>
Henry Wong <henryw4k@gmail.com>
Steve Mao <maochenyan@gmail.com>
Jon Dufresne <jon.dufresne@gmail.com>
Jae Sung Park <alberto.park@gmail.com>
Josh Soref <apache@soref.com>
Saptak Sengupta <saptak013@gmail.com>
Henry Wong <henryw4k@gmail.com>
Jun Sun <klsforever@gmail.com>
Martijn W. van der Lee <martijn@vanderlee.com>
Devin Wilson <dwilson6.github@gmail.com>
Steve Mao <maochenyan@gmail.com>
Damian Senn <jquery@topaxi.codes>
Zack Hall <zackhall@outlook.com>
Bernhard M. Wiedemann <jquerybmw@lsmod.de>
Todor Prikumov <tono_pr@abv.bg>
Jha Naman <createnaman@gmail.com>
William Robinet <william.robinet@conostix.com>
Alexander Lisianoi <all3fox@gmail.com>
Vitaliy Terziev <vitaliyterziev@gmail.com>
Todor Prikumov <tono_pr@abv.bg>
Bernhard M. Wiedemann <jquerybmw@lsmod.de>
Jha Naman <createnaman@gmail.com>
Alexander Lisianoi <all3fox@gmail.com>
William Robinet <william.robinet@conostix.com>
Joe Trumbull <trumbull.j@gmail.com>
Alexander K <xpyro@ya.ru>
Damian Senn <jquery@topaxi.codes>
Ralin Chimev <ralin.chimev@gmail.com>
Felipe Sateler <fsateler@gmail.com>
Christophe Tafani-Dereeper <christophetd@hotmail.fr>
@ -297,25 +323,32 @@ Manoj Kumar <nithmanoj@gmail.com>
David Broder-Rodgers <broder93@gmail.com>
Alex Louden <alex@louden.com>
Alex Padilla <alexonezero@outlook.com>
南漂一卒 <shiy007@qq.com>
karan-96 <karanbatra96@gmail.com>
南漂一卒 <shiy007@qq.com>
Erik Lax <erik@datahack.se>
Boom Lee <teabyii@gmail.com>
Andreas Solleder <asol@num42.de>
CDAGaming <cstack2011@yahoo.com>
Pierre Spring <pierre@nelm.io>
Shashanka Nataraj <shashankan.10@gmail.com>
Erik Lax <erik@datahack.se>
CDAGaming <cstack2011@yahoo.com>
Matan Kotler-Berkowitz <205matan@gmail.com>
Jordan Beland <jordan.beland@gmail.com>
Henry Zhu <hi@henryzoo.com>
Saptak Sengupta <saptak013@gmail.com>
Nilton Cesar <niltoncms@gmail.com>
basil.belokon <basil.belokon@gmail.com>
Andrey Meshkov <ay.meshkov@gmail.com>
tmybr11 <tomas.perone@gmail.com>
Luis Emilio Velasco Sanchez <emibloque@gmail.com>
Ed S <ejsanders@gmail.com>
Bert Zhang <enbo@users.noreply.github.com>
Sébastien Règne <regseb@users.noreply.github.com>
wartmanm <3869625+wartmanm@users.noreply.github.com>
Siddharth Dungarwal <sd5869@gmail.com>
abnud1 <ahmad13932013@hotmail.com>
Andrei Fangli <andrei_fangli@outlook.com>
Marja Hölttä <marja.holtta@gmail.com>
abnud1 <ahmad13932013@hotmail.com>
buddh4 <mail@jharrer.de>
Hoang <dangkyokhoang@gmail.com>
Wonseop Kim <wonseop.kim@samsung.com>
Pat O'Callaghan <patocallaghan@gmail.com>
JuanMa Ruiz <ruizjuanma@gmail.com>

View File

@ -64,8 +64,7 @@ module.exports = function( grunt ) {
deferred: {
remove: [ "ajax", "effects", "queue", "core/ready" ],
include: [ "core/ready-no-deferred" ]
},
sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
}
}
}
},
@ -75,9 +74,6 @@ module.exports = function( grunt ) {
destPrefix: "external"
},
files: {
"sizzle/dist": "sizzle/dist",
"sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
"npo/npo.js": "native-promise-only/npo.js",
"qunit/qunit.js": "qunit/qunit/qunit.js",

View File

@ -100,12 +100,6 @@ Some example modules that can be excluded are:
- **exports/global**: Exclude the attachment of global jQuery variables ($ and jQuery) to the window.
- **exports/amd**: Exclude the AMD definition.
As a special case, you may also replace Sizzle by using a special flag `grunt custom:-sizzle`.
- **sizzle**: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the [selector-native.js](https://github.com/jquery/jquery/blob/master/src/selector-native.js) file for details.
*Note*: Excluding Sizzle will also exclude all jQuery selector extensions (such as `effects/animatedSelector` and `css/hiddenVisibleSelectors`).
The build process shows a message for each dependent module it excludes or includes.
##### AMD name
@ -156,7 +150,7 @@ Exclude a bunch of modules:
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap
```
For questions or requests regarding custom builds, please start a thread on the [Developing jQuery Core](https://forum.jquery.com/developing-jquery-core) section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.
For questions or requests regarding custom builds, please start a thread on the [Developing jQuery Core](https://forum.jquery.com/developing-jquery-core) section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process.
Running the Unit Tests
--------------------------------------

View File

@ -14,7 +14,6 @@ module.exports = function( Release ) {
],
cdn = require( "./release/cdn" ),
dist = require( "./release/dist" ),
ensureSizzle = require( "./release/ensure-sizzle" ),
npmTags = Release.npmTags;
@ -22,14 +21,6 @@ module.exports = function( Release ) {
npmPublish: true,
issueTracker: "github",
/**
* Ensure the repo is in a proper state before release
* @param {Function} callback
*/
checkRepoState: function( callback ) {
ensureSizzle( Release, callback );
},
/**
* Set the version in the src folder for distributing AMD
*/

View File

@ -65,7 +65,6 @@ module.exports = function( Release, files, complete ) {
// Copy dist files
var distFolder = Release.dir.dist + "/dist",
externalFolder = Release.dir.dist + "/external",
readme = fs.readFileSync( Release.dir.dist + "/README.md", "utf8" ),
rmIgnore = files
.concat( [
@ -88,10 +87,6 @@ module.exports = function( Release, files, complete ) {
shell.cp( "-f", Release.dir.repo + "/" + file, distFolder );
} );
// Copy Sizzle
shell.mkdir( "-p", externalFolder );
shell.cp( "-rf", Release.dir.repo + "/external/sizzle", externalFolder );
// Copy other files
extras.forEach( function( file ) {
shell.cp( "-rf", Release.dir.repo + "/" + file, Release.dir.dist );

View File

@ -1,52 +0,0 @@
var fs = require( "fs" ),
npm = require( "npm" ),
chalk = require( "chalk" ),
sizzleLoc = __dirname + "/../../external/sizzle/dist/sizzle.js",
rversion = /Engine v(\d+\.\d+\.\d+(?:-[-\.\d\w]+)?)/;
/**
* Retrieve the latest tag of Sizzle from npm
* @param {Function(string)} callback
*/
function getLatestSizzle( callback ) {
npm.load( function( err, npm ) {
if ( err ) {
throw err;
}
npm.commands.info( [ "sizzle", "version" ], function( err, info ) {
if ( err ) {
throw err;
}
callback( Object.keys( info )[ 0 ] );
} );
} );
}
/**
* Ensure the /src folder has the latest tag of Sizzle
* @param {Object} Release
* @param {Function} callback
*/
function ensureSizzle( Release, callback ) {
console.log();
console.log( "Checking Sizzle version..." );
getLatestSizzle( function( latest ) {
var match = rversion.exec( fs.readFileSync( sizzleLoc, "utf8" ) ),
version = match ? match[ 1 ] : "Not Found";
if ( version !== latest ) {
// colors is inherited from jquery-release
console.log(
"The Sizzle version in the src folder (" + chalk.red( version ) +
") is not the latest tag (" + chalk.green( latest ) + ")."
);
Release.confirm( callback );
} else {
console.log( "Sizzle is latest (" + chalk.green( latest ) + ")" );
callback();
}
} );
}
module.exports = ensureSizzle;

View File

@ -72,13 +72,6 @@ module.exports = function( grunt ) {
)
.replace( rdefineEnd, "" );
// Sizzle treatment
} else if ( /\/sizzle$/.test( name ) ) {
contents = "var Sizzle =\n" + contents
// Remove EXPOSE lines from Sizzle
.replace( /\/\/\s*EXPOSE[\w\W]*\/\/\s*EXPOSE/, "return Sizzle;" );
} else {
contents = contents
@ -218,11 +211,6 @@ module.exports = function( grunt ) {
}
} else {
grunt.log.error( "Module \"" + module + "\" is a minimum requirement." );
if ( module === "selector" ) {
grunt.log.error(
"If you meant to replace Sizzle, use -sizzle instead."
);
}
}
} else {
grunt.log.writeln( flag );
@ -259,13 +247,6 @@ module.exports = function( grunt ) {
excluder( flag );
}
// Handle Sizzle exclusion
// Replace with selector-native
if ( ( index = excluded.indexOf( "sizzle" ) ) > -1 ) {
config.rawText.selector = "define(['./selector-native']);";
excluded.splice( index, 1 );
}
// Replace exports/global with a noop noConflict
if ( ( index = excluded.indexOf( "exports/global" ) ) > -1 ) {
config.rawText[ "exports/global" ] = "define(['../core']," +

15
dist/.eslintrc.json vendored
View File

@ -5,19 +5,6 @@
"rules": {
// That is okay for the built version
"no-multiple-empty-lines": "off",
// Sizzle is not compatible with jQuery code style
"no-nested-ternary": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"lines-around-comment": "off",
"space-in-parens": "off",
"camelcase": "off",
"computed-property-spacing": "off",
"max-len": "off",
"dot-notation": "off",
"semi-spacing": "off",
"brace-style": "off"
"no-multiple-empty-lines": "off"
}
}

View File

@ -1,36 +0,0 @@
Copyright JS Foundation and other contributors, https://js.foundation/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/sizzle
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -61,7 +61,6 @@
"raw-body": "2.3.3",
"requirejs": "2.3.6",
"sinon": "7.3.1",
"sizzle": "2.3.4",
"strip-json-comments": "2.0.1",
"testswarm": "1.1.0",
"uglify-js": "3.4.7"

View File

@ -9,9 +9,6 @@ define( [
"use strict";
var boolHook,
attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend( {
attr: function( name, value ) {
return access( this, jQuery.attr, name, value, arguments.length > 1 );
@ -42,8 +39,7 @@ jQuery.extend( {
// Attribute hooks are determined by the lowercase version
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
hooks = jQuery.attrHooks[ name.toLowerCase() ];
}
if ( value !== undefined ) {
@ -65,7 +61,7 @@ jQuery.extend( {
return ret;
}
ret = jQuery.find.attr( elem, name );
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ? undefined : ret;
@ -105,38 +101,31 @@ jQuery.extend( {
}
} );
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
elem.setAttribute( name, name );
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr;
jQuery.attrHooks[ name ] = {
get: function( elem ) {
var ret,
isXML = jQuery.isXMLDoc( elem ),
lowercaseName = name.toLowerCase();
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle,
lowercaseName = name.toLowerCase();
if ( !isXML ) {
ret = elem.getAttribute( name ) != null ?
lowercaseName :
null;
}
return ret;
},
if ( !isXML ) {
set: function( elem, value, name ) {
if ( value === false ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ lowercaseName ];
attrHandle[ lowercaseName ] = ret;
ret = getter( elem, name, isXML ) != null ?
lowercaseName :
null;
attrHandle[ lowercaseName ] = handle;
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
elem.setAttribute( name, name );
}
return name;
}
return ret;
};
} );

View File

@ -64,7 +64,7 @@ jQuery.extend( {
// correct value when it hasn't been explicitly set
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
var tabindex = elem.getAttribute( "tabindex" );
if ( tabindex ) {
return parseInt( tabindex, 10 );

View File

@ -84,7 +84,7 @@ jQuery.extend( {
option: {
get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
var val = elem.getAttribute( "value" );
return val != null ?
val :

View File

@ -25,8 +25,9 @@ define( [
"use strict";
var
version = "@VERSION",
var version = "@VERSION",
rhtmlSuffix = /HTML$/i,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@ -259,6 +260,44 @@ jQuery.extend( {
return obj;
},
// Retrieve the text value of an array of DOM nodes
text: function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( ( node = elem[ i++ ] ) ) {
// Do not traverse comment nodes
ret += jQuery.text( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += jQuery.text( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
},
trim: function( text ) {
return text == null ? "" : trim.call( text );
},
@ -285,6 +324,15 @@ jQuery.extend( {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
isXMLDoc: function( elem ) {
var namespace = elem.namespaceURI,
docElem = ( elem.ownerDocument || elem ).documentElement;
// Assume HTML when documentElement doesn't yet exist, such as inside
// document fragments.
return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
},
merge: function( first, second ) {
var len = +second.length,
j = 0,

View File

@ -1,7 +1,7 @@
define( [
"../core",
"../var/documentElement",
"../selector" // jQuery.contains
"../selector/contains" // jQuery.contains
], function( jQuery, documentElement ) {
"use strict";

7
src/core/var/rhtml.js Normal file
View File

@ -0,0 +1,7 @@
define( function() {
"use strict";
return ( /HTML$/i );
} );

View File

@ -30,13 +30,9 @@ define( [
var
/* eslint-disable max-len */
// See https://github.com/eslint/eslint/issues/3229
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
/* eslint-enable */
// Support: IE <=10 - 11+, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
@ -223,7 +219,8 @@ jQuery.extend( {
if ( isIE && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
!jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
// We eschew jQuery#find here for performance reasons:
// https://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );

View File

@ -1,240 +0,0 @@
define( [
"./core",
"./var/document",
"./var/documentElement",
"./var/hasOwn",
"./var/indexOf"
], function( jQuery, document, documentElement, hasOwn, indexOf ) {
"use strict";
/*
* Optional (non-Sizzle) selector module for custom builds.
*
* Note that this DOES NOT SUPPORT many documented jQuery
* features in exchange for its smaller size:
*
* Attribute not equal selector
* Positional selectors (:first; :eq(n); :odd; etc.)
* Type selectors (:input; :checkbox; :button; etc.)
* State-based selectors (:animated; :visible; :hidden; etc.)
* :has(selector)
* :not(complex selector)
* custom selectors via Sizzle extensions
* Leading combinators (e.g., $collection.find("> *"))
* Reliable functionality on XML fragments
* Requiring all parts of a selector to match elements under context
* (e.g., $div.find("div > *") now matches children of $div)
* Matching against non-elements
* Reliable sorting of disconnected nodes
* querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
*
* If any of these are unacceptable tradeoffs, either use Sizzle or
* customize this stub for the project's specific needs.
*/
var hasDuplicate, sortInput,
rhtmlSuffix = /HTML$/i,
sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando,
// Support: IE 9 - 11+
// IE requires a prefix.
matches = documentElement.matches || documentElement.msMatchesSelector,
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
};
function sortOrder( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ) {
// Choose the first element that is related to our preferred document
if ( a === document || a.ownerDocument === document &&
jQuery.contains( document, a ) ) {
return -1;
}
if ( b === document || b.ownerDocument === document &&
jQuery.contains( document, b ) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
}
function uniqueSort( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
hasDuplicate = false;
sortInput = !sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( ( elem = results[ i++ ] ) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
}
function escape( sel ) {
return ( sel + "" ).replace( rcssescape, fcssescape );
}
jQuery.extend( {
uniqueSort: uniqueSort,
unique: uniqueSort,
escapeSelector: escape,
find: function( selector, context, results, seed ) {
var elem, nodeType,
i = 0;
results = results || [];
context = context || document;
// Same basic safeguard as Sizzle
if ( !selector || typeof selector !== "string" ) {
return results;
}
// Early return if context is not an element or document
if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 ) {
return [];
}
if ( seed ) {
while ( ( elem = seed[ i++ ] ) ) {
if ( jQuery.find.matchesSelector( elem, selector ) ) {
results.push( elem );
}
}
} else {
jQuery.merge( results, context.querySelectorAll( selector ) );
}
return results;
},
text: function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( ( node = elem[ i++ ] ) ) {
// Do not traverse comment nodes
ret += jQuery.text( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
return elem.textContent;
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
},
contains: function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains( bup ) );
},
isXMLDoc: function( elem ) {
var namespace = elem.namespaceURI,
documentElement = ( elem.ownerDocument || elem ).documentElement;
// Assume HTML when documentElement doesn't yet exist, such as inside
// document fragments.
return !rhtmlSuffix.test( namespace ||
documentElement && documentElement.nodeName ||
"HTML" );
},
expr: {
attrHandle: {},
match: {
bool: new RegExp( "^(?:checked|selected|async|autofocus|autoplay|controls|defer" +
"|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$", "i" ),
needsContext: /^[\x20\t\r\n\f]*[>+~]/
}
}
} );
jQuery.extend( jQuery.find, {
matches: function( expr, elements ) {
return jQuery.find( expr, null, null, elements );
},
matchesSelector: function( elem, expr ) {
return matches.call( elem, expr );
},
attr: function( elem, name ) {
var fn = jQuery.expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
value = fn && hasOwn.call( jQuery.expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, jQuery.isXMLDoc( elem ) ) :
undefined;
return value !== undefined ? value : elem.getAttribute( name );
}
} );
} );

View File

@ -1,20 +0,0 @@
define( [
"./core",
"../external/sizzle/dist/sizzle"
], function( jQuery, Sizzle ) {
"use strict";
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;
} );

File diff suppressed because it is too large Load Diff

22
src/selector/contains.js Normal file
View File

@ -0,0 +1,22 @@
define( [
"../core"
], function( jQuery ) {
"use strict";
// Note: an element does not contain itself
jQuery.contains = function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
// Support: IE 9 - 11+
// IE doesn't have `contains` on SVG.
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
) );
};
} );

View File

@ -0,0 +1,31 @@
define( [
"../core"
], function( jQuery ) {
"use strict";
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
function fcssescape( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
}
jQuery.escapeSelector = function( sel ) {
return ( sel + "" ).replace( rcssescape, fcssescape );
};
} );

View File

@ -0,0 +1,80 @@
define( [
"../core",
"../var/document"
], function( jQuery, document ) {
"use strict";
var hasDuplicate;
// Document order sorting
function sortOrder( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ) {
// Choose the first element that is related to the document
if ( a === document || a.ownerDocument === document &&
jQuery.contains( document, a ) ) {
return -1;
}
if ( b === document || b.ownerDocument === document &&
jQuery.contains( document, b ) ) {
return 1;
}
// Maintain original order
return 0;
}
return compare & 4 ? -1 : 1;
}
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
jQuery.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
hasDuplicate = false;
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( ( elem = results[ i++ ] ) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
} );

View File

@ -55,7 +55,7 @@ jQuery.fn.extend( {
if ( cur.nodeType < 11 && ( targets ?
targets.index( cur ) > -1 :
// Don't pass non-elements to Sizzle
// Don't pass non-elements to jQuery#find
cur.nodeType === 1 &&
jQuery.find.matchesSelector( cur, selectors ) ) ) {

7
src/var/pop.js Normal file
View File

@ -0,0 +1,7 @@
define( [
"./arr"
], function( arr ) {
"use strict";
return arr.pop;
} );

View File

@ -3,9 +3,6 @@
* jQuery JavaScript Library v@VERSION
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jQuery selector - sizzle cache</title>
<title>jQuery selector - cache</title>
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>

View File

@ -12,7 +12,6 @@
var doc = parent.document,
unframed = [ doc.getElementById( "qunit-fixture" ), doc.body, doc.documentElement ],
framed = jQuery.find( "*" );
parent.console.log( unframed );
startIframeTest(
jQuery.uniqueSort( unframed.concat( framed ) ),

View File

@ -45,7 +45,7 @@ this.q = function() {
/**
* Asserts that a select matches the given IDs
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} selector - jQuery selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @param {(String|Node)=document} context - Selector context
* @example match("Check for something", "p", ["foo", "bar"]);
@ -60,7 +60,7 @@ function match( message, selector, expectedIds, context, assert ) {
* Asserts that a select matches the given IDs.
* The select is not bound by a context.
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} selector - jQuery selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @example t("Check for something", "p", ["foo", "bar"]);
*/
@ -72,7 +72,7 @@ QUnit.assert.t = function( message, selector, expectedIds ) {
* Asserts that a select matches the given IDs.
* The select is performed within the `#qunit-fixture` context.
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} selector - jQuery selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @example selectInFixture("Check for something", "p", ["foo", "bar"]);
*/
@ -280,6 +280,18 @@ if ( !window.__karma__ ) {
QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
// Says whether jQuery positional selector extensions are supported.
// A full selector engine is required to support them as they need to be evaluated
// left-to-right. Remove that property when support for positional selectors is dropped.
// if your custom jQuery versions relies more on native qSA.
QUnit.jQuerySelectorsPos = true;
// Says whether jQuery selector extensions are supported. Change that to `false`
// if your custom jQuery versions relies more on native qSA.
// This doesn't include support for positional selectors (see above).
// TODO do we want to keep this or just assume support for jQuery extensions?
QUnit.jQuerySelectors = true;
// Support: IE 11+
// A variable to make it easier to skip specific tests in IE, mostly
// testing integrations with newer Web features not supported by it.

View File

@ -488,29 +488,6 @@ QUnit.test( "attr(non-ASCII)", function( assert ) {
assert.equal( $div.attr( "AØC" ), "alpha", ".attr() exclusively lowercases characters in the range A-Z (gh-2730)" );
} );
QUnit.test( "attr - extending the boolean attrHandle", function( assert ) {
assert.expect( 1 );
var called = false,
origAttrHandleHadChecked = "checked" in jQuery.expr.attrHandle,
origAttrHandleChecked = jQuery.expr.attrHandle.checked,
_handle = origAttrHandleChecked || $.noop;
jQuery.expr.attrHandle.checked = function() {
called = true;
_handle.apply( this, arguments );
};
jQuery( "#qunit-fixture input" ).attr( "checked" );
called = false;
jQuery( "#qunit-fixture input" ).attr( "checked" );
assert.ok( called, "The boolean attrHandle does not drop custom attrHandles" );
if ( origAttrHandleHadChecked ) {
jQuery.expr.attrHandle.checked = origAttrHandleChecked;
} else {
delete jQuery.expr.attrHandle.checked;
}
} );
QUnit.test( "attr(String, Object) - Loaded via XML document", function( assert ) {
assert.expect( 2 );
var xml = createDashboardXML(),

View File

@ -66,7 +66,7 @@ QUnit.test( "jQuery()", function( assert ) {
assert.equal( jQuery( "" ).length, 0, "jQuery('') === jQuery([])" );
assert.deepEqual( jQuery( obj ).get(), obj.get(), "jQuery(jQueryObj) == jQueryObj" );
// Invalid #id goes to Sizzle which will throw an error (gh-1682)
// Invalid #id will throw an error (gh-1682)
try {
jQuery( "#" );
} catch ( e ) {
@ -153,7 +153,7 @@ QUnit.test( "jQuery()", function( assert ) {
"Empty attributes object is not interpreted as a document (trac-8950)" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "jQuery(selector, context)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "jQuery(selector, context)", function( assert ) {
assert.expect( 3 );
assert.deepEqual( jQuery( "div p", "#qunit-fixture" ).get(), q( "sndp", "en", "sap" ), "Basic selector with string as context" );
assert.deepEqual( jQuery( "div p", q( "qunit-fixture" )[ 0 ] ).get(), q( "sndp", "en", "sap" ), "Basic selector with element as context" );
@ -484,7 +484,7 @@ QUnit.test( "jQuery('html')", function( assert ) {
//equal( jQuery( "element[attribute=<div></div>]" ).length, 0,
// "When html is within brackets, do not recognize as html." );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( jQuery( "element:not(<div></div>)" ).length, 0,
"When html is within parens, do not recognize as html." );
} else {

View File

@ -970,7 +970,7 @@ QUnit.test( "show/hide 3.0, inline hidden", function( assert ) {
}
QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "toggle()", function( assert ) {
QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle ? "test" : "skip" ]( "toggle()", function( assert ) {
assert.expect( 9 );
var div, oldHide,
x = jQuery( "#foo" );
@ -1003,7 +1003,7 @@ QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "toggle()",
jQuery.fn.hide = oldHide;
} );
QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "detached toggle()", function( assert ) {
QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle ? "test" : "skip" ]( "detached toggle()", function( assert ) {
assert.expect( 6 );
var detached = jQuery( "<p><a/><p>" ).find( "*" ).addBack(),
hiddenDetached = jQuery( "<p><a/></p>" ).find( "*" ).addBack().css( "display", "none" ),
@ -1027,8 +1027,11 @@ QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "detached to
"cascade-hidden element in detached tree" );
} );
QUnit[ jQuery.find.compile && jQuery.fn.toggle && document.body.getRootNode ? "test" : "skip" ]( "shadow toggle()", function( assert ) {
QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle && document.body.getRootNode ? "test" : "skip" ](
"shadow toggle()", function( assert ) {
assert.expect( 4 );
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
var shadowHost = document.querySelector( "#shadowHost" );
var shadowRoot = shadowHost.attachShadow( { mode: "open" } );
@ -1459,7 +1462,7 @@ QUnit.test( "css opacity consistency across browsers (#12685)", function( assert
assert.equal( Math.round( el.css( "opacity" ) * 100 ), 10, "remove opacity override" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( ":visible/:hidden selectors", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( ":visible/:hidden selectors", function( assert ) {
assert.expect( 18 );
var $div, $table, $a, $br;
@ -1493,7 +1496,12 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( ":visible/:hidden selectors", fu
$table.css( "display", "none" ).html( "<tr><td>cell</td><td>cell</td></tr>" );
assert.equal( jQuery( "#table td:visible" ).length, 0, "hidden cell children not perceived as visible (#4512)" );
assert.t( "Is Visible", "#qunit-fixture div:visible:lt(2)", [ "foo", "nothiddendiv" ] );
if ( QUnit.jQuerySelectorsPos ) {
assert.t( "Is Visible", "#qunit-fixture div:visible:lt(2)", [ "foo", "nothiddendiv" ] );
} else {
assert.ok( "skip", "Positional selectors are not supported" );
}
assert.t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
assert.t( "Is Hidden", "#form input:hidden", [ "hidden1", "hidden2" ] );

16
test/unit/effects.js vendored
View File

@ -29,7 +29,7 @@ QUnit.module( "effects", {
}
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "sanity check", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "sanity check", function( assert ) {
assert.expect( 1 );
assert.equal( jQuery( "#qunit-fixture:visible, #foo:visible" ).length, 2, "QUnit state is correct for testing effects" );
} );
@ -809,7 +809,7 @@ QUnit.test( "stop( queue, ..., ... ) - Stop single queues", function( assert ) {
this.clock.tick( 500 );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "toggle()", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "toggle()", function( assert ) {
assert.expect( 6 );
var x = jQuery( "#foo" );
assert.ok( x.is( ":visible" ), "is visible" );
@ -1640,7 +1640,7 @@ QUnit.test( "animate should set display for disconnected nodes", function( asser
clock.tick( 400 );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "Animation callback should not show animated element as :animated (#7157)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "Animation callback should not show animated element as :animated (#7157)", function( assert ) {
assert.expect( 1 );
var foo = jQuery( "#foo" );
@ -1653,7 +1653,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "Animation callback should not s
this.clock.tick( 100 );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "Initial step callback should show element as :animated (#14623)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "Initial step callback should show element as :animated (#14623)", function( assert ) {
assert.expect( 1 );
var foo = jQuery( "#foo" );
@ -2169,7 +2169,7 @@ QUnit.test( ".finish() completes all queued animations", function( assert ) {
} );
assert.equal( div.queue().length, 0, "empty queue when done" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( div.is( ":animated" ), false, ":animated doesn't match" );
} else {
assert.ok( "skip", ":animated selector not supported with selector-native" );
@ -2209,7 +2209,7 @@ QUnit.test( ".finish( false ) - unqueued animations", function( assert ) {
assert.equal( parseFloat( div.css( prop ) ), value, prop + " finished at correct value" );
} );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( div.is( ":animated" ), false, ":animated doesn't match" );
} else {
assert.ok( "skip", ":animated selector not supported with selector-native" );
@ -2248,7 +2248,7 @@ QUnit.test( ".finish( \"custom\" ) - custom queue animations", function( assert
// start the first animation
div.dequeue( "custom" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( div.is( ":animated" ), true, ":animated matches" );
} else {
assert.ok( "skip", ":animated selector not supported with selector-native" );
@ -2259,7 +2259,7 @@ QUnit.test( ".finish( \"custom\" ) - custom queue animations", function( assert
assert.equal( parseFloat( div.css( prop ) ), value, prop + " finished at correct value" );
} );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( div.is( ":animated" ), false, ":animated doesn't match" );
} else {
assert.ok( "skip", ":animated selector not supported with selector-native" );

View File

@ -1797,7 +1797,7 @@ QUnit.test( "jQuery.off using dispatched jQuery.Event", function( assert ) {
} );
// selector-native does not support scope-fixing in delegation
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "delegated event with delegateTarget-relative selector", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "delegated event with delegateTarget-relative selector", function( assert ) {
assert.expect( 3 );
var markup = jQuery( "<div><ul><li><a id=\"a0\"></a><ul id=\"ul0\"><li class=test><a id=\"a0_0\"></a></li><li><a id=\"a0_1\"></a></li></ul></li></ul></div>" ).appendTo( "#qunit-fixture" );
@ -1815,18 +1815,23 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "delegated event with delegateTa
.find( "#a0_0" ).trigger( "click" ).end()
.off( "click" );
// Positional selector (#11315)
markup.find( "ul" ).eq( 0 )
.on( "click", ">li>a", function() {
assert.ok( this.id === "a0", "child li was clicked" );
} )
.find( "#ul0" )
.on( "click", "li:first>a", function() {
assert.ok( this.id === "a0_0", "first li under #u10 was clicked" );
if ( QUnit.jQuerySelectorsPos ) {
// Positional selector (#11315)
markup.find( "ul" ).eq( 0 )
.on( "click", ">li>a", function() {
assert.ok( this.id === "a0", "child li was clicked" );
} )
.end()
.find( "a" ).trigger( "click" ).end()
.find( "#ul0" ).off();
.find( "#ul0" )
.on( "click", "li:first>a", function() {
assert.ok( this.id === "a0_0", "first li under #u10 was clicked" );
} )
.end()
.find( "a" ).trigger( "click" ).end()
.find( "#ul0" ).off();
} else {
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
markup.remove();
} );

View File

@ -1943,7 +1943,7 @@ QUnit.test( "remove() with filters", function( assert ) {
div.children().remove( "span:nth-child(2n)" );
assert.equal( div.text(), "13", "relative selector in remove" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
div = jQuery( markup );
div.children().remove( "span:first" );
assert.equal( div.text(), "234", "positional selector in remove" );
@ -1951,8 +1951,8 @@ QUnit.test( "remove() with filters", function( assert ) {
div.children().remove( "span:last" );
assert.equal( div.text(), "123", "positional selector in remove" );
} else {
assert.ok( "skip", "Positional selectors not supported in selector-native" );
assert.ok( "skip", "Positional selectors not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
// using contents will get comments regular, text, and comment nodes
@ -2040,7 +2040,7 @@ QUnit.test( "detach() with filters", function( assert ) {
div.children().detach( "span:nth-child(2n)" );
assert.equal( div.text(), "13", "relative selector in detach" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
div = jQuery( markup );
div.children().detach( "span:first" );
assert.equal( div.text(), "234", "positional selector in detach" );
@ -2048,8 +2048,8 @@ QUnit.test( "detach() with filters", function( assert ) {
div.children().detach( "span:last" );
assert.equal( div.text(), "123", "positional selector in detach" );
} else {
assert.ok( "skip", "positional selectors not supported in selector-native" );
assert.ok( "skip", "positional selectors not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
// using contents will get comments regular, text, and comment nodes

View File

@ -21,7 +21,7 @@ QUnit.test( "empty", function( assert ) {
form = document.getElementById( "form" );
assert.ok( !jQuery( form ).is( "" ), "Empty string passed to .is() does not match" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.equal( jQuery.find( " " ).length, 0, "Empty selector returns an empty array" );
assert.equal( jQuery.find( "\t" ).length, 0, "Empty selector returns an empty array" );
} else {
@ -100,10 +100,10 @@ QUnit.test( "element", function( assert ) {
jQuery( "<h1 id='h1'/><h2 id='h2'/><h2 id='h2-2'/>" ).prependTo( "#qunit-fixture" );
assert.t( "Checking sort order", "#qunit-fixture h2, #qunit-fixture h1", [ "h1", "h2", "h2-2" ] );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
assert.t( "Checking sort order", "#qunit-fixture h2:first, #qunit-fixture h1:first", [ "h1", "h2" ] );
} else {
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
}
assert.t( "Checking sort order", "#qunit-fixture p, #qunit-fixture p a",
@ -119,7 +119,7 @@ QUnit.test( "element", function( assert ) {
assert.deepEqual( jQuery.find( "input[id='idTest']", lengthtest ), q( "idTest" ),
"Finding elements with id of ID." );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
siblingTest = document.getElementById( "siblingTest" );
assert.deepEqual( jQuery.find( "div em", siblingTest ), [],
"Element-rooted QSA does not select based on document context" );
@ -165,7 +165,7 @@ QUnit.test( "XML Document Selectors", function( assert ) {
"Attribute selector filter with ID" );
assert.equal( jQuery.find( "meta property thing", xml ).length, 2,
"Descendent selector and dir caching" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.ok( jQuery( xml.lastChild ).is( "soap\\:Envelope" ), "Check for namespaced element" );
xml = jQuery.parseXML( "<?xml version='1.0' encoding='UTF-8'?><root><elem id='1'/></root>" );
@ -179,7 +179,7 @@ QUnit.test( "XML Document Selectors", function( assert ) {
} );
QUnit.test( "broken selectors throw", function( assert ) {
assert.expect( 31 );
assert.expect( 32 );
function broken( name, selector ) {
assert.throws( function() {
@ -197,6 +197,7 @@ QUnit.test( "broken selectors throw", function( assert ) {
broken( "Broken Selector", "," );
broken( "Broken Selector", ",a" );
broken( "Broken Selector", "a," );
broken( "Identifier with bad escape", "foo\\\fbaz" );
broken( "Broken Selector", "[id=012345678901234567890123456789" );
broken( "Doesn't exist", ":visble" );
broken( "Nth-child", ":nth-child" );
@ -243,7 +244,7 @@ QUnit.test( "id", function( assert ) {
assert.t( "Escaped ID", "#foo\\:bar", [ "foo:bar" ] );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Escaped ID with descendant", "#foo\\:bar span:not(:input)", [ "foo_descendant" ] );
} else {
assert.ok( "skip", ":input not supported in selector-native" );
@ -258,7 +259,7 @@ QUnit.test( "id", function( assert ) {
fiddle = jQuery( "<div id='fiddle\\Foo'><span id='fiddleSpan'></span></div>" )
.appendTo( "#qunit-fixture" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual( jQuery.find( "> span", jQuery( "#fiddle\\\\Foo" )[ 0 ] ),
q( [ "fiddleSpan" ] ), "Escaped ID as context" );
} else {
@ -448,20 +449,24 @@ QUnit.test( "child and adjacent", function( assert ) {
siblingFirst = document.getElementById( "siblingfirst" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual( jQuery.find( "+ em", siblingFirst ), q( "siblingnext" ),
"Element Directly Preceded By with a context." );
assert.deepEqual( jQuery.find( "~ em", siblingFirst ), q( "siblingnext", "siblingthird" ),
"Element Preceded By with a context." );
assert.deepEqual( jQuery.find( "~ em:first", siblingFirst ), q( "siblingnext" ),
"Element Preceded By positional with a context." );
} else {
assert.ok( "skip", "leading + not supported in selector-native" );
assert.ok( "skip", "leading ~ not supported in selector-native" );
assert.ok( "skip", "leading ~ not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
assert.deepEqual( jQuery.find( "~ em:first", siblingFirst ), q( "siblingnext" ),
"Element Preceded By positional with a context." );
} else {
assert.ok( "skip", "Positional selectors are not supported" );
}
if ( QUnit.jQuerySelectors ) {
en = document.getElementById( "en" );
assert.deepEqual( jQuery.find( "+ p, a", en ), q( "yahoo", "sap" ),
"Compound selector with context, beginning with sibling test." );
@ -472,9 +477,15 @@ QUnit.test( "child and adjacent", function( assert ) {
assert.ok( "skip", "leading + not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", [ "siblingfirst" ] );
assert.t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] );
} else {
assert.ok( "skip", ":contains not supported in selector-native" );
assert.ok( "skip", ":contains not supported in selector-native" );
}
if ( QUnit.jQuerySelectorsPos ) {
assert.equal( jQuery( "#listWithTabIndex li:eq(2) ~ li" ).length, 1, "Find by general sibling combinator (#8310)" );
nothiddendiv = document.getElementById( "nothiddendiv" );
@ -484,14 +495,11 @@ QUnit.test( "child and adjacent", function( assert ) {
"Verify child context positional selector" );
assert.deepEqual( jQuery.find( "> *:first", nothiddendiv ), q( "nothiddendivchild" ),
"Verify child context positional selector" );
} else {
assert.ok( "skip", ":contains not supported in selector-native" );
assert.ok( "skip", ":contains not supported in selector-native" );
assert.ok( "skip", ":eq not supported in selector-native" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", ":eq not supported in selector-native" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
assert.t( "Multiple combinators selects all levels", "#siblingTest em *", [ "siblingchild", "siblinggrandchild", "siblinggreatgrandchild" ] );
@ -531,15 +539,15 @@ QUnit.test( "attributes - equals", function( assert ) {
assert.t( "Non-identifier string", "#qunit-fixture a[href='http://www.google.com/']", [ "google" ] );
assert.t( "Empty string", "#select1 option[value='']", [ "option1a" ] );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Number",
"#qunit-fixture option[value=1]",
[ "option1b", "option2b", "option3b", "option4b", "option5c" ] );
assert.t( "negative number",
"#qunit-fixture li[tabIndex=-1]", [ "foodWithNegativeTabIndex" ] );
} else {
assert.ok( true, "Number value not supported in selector-native" );
assert.ok( true, "Negative number value not supported in selector-native" );
assert.ok( "skip", "Number value not supported in selector-native" );
assert.ok( "skip", "Negative number value not supported in selector-native" );
}
assert.t( "Non-ASCII identifier", "span[lang=中文]", [ "台北" ] );
@ -573,7 +581,7 @@ QUnit.test( "attributes - equals", function( assert ) {
"With context, double-quoted attribute containing ','" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "attributes - does not equal", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "attributes - does not equal", function( assert ) {
assert.expect( 2 );
assert.t( "string", "#ap a[hreflang!='en']", [ "google", "groups", "anchor1" ] );
@ -740,7 +748,7 @@ QUnit.test( "pseudo - (parent|empty)", function( assert ) {
assert.t( "Empty", "#qunit-fixture ul:empty", [ "firstUL" ] );
assert.t( "Empty with comment node", "#qunit-fixture ol:empty", [ "empty" ] );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Is A Parent", "#qunit-fixture p:parent",
[ "firstp", "ap", "sndp", "en", "sap", "first" ] );
} else {
@ -808,7 +816,7 @@ QUnit.test( "pseudo - nth-child", function( assert ) {
assert.t( "Nth-child(-n+3)", "#form #select1 option:nth-child(-n+3)", [ "option1a", "option1b", "option1c" ] );
assert.t( "Nth-child(-1n + 3)", "#form #select1 option:nth-child(-1n + 3)", [ "option1a", "option1b", "option1c" ] );
if ( jQuery.find.compile || this.safari ) {
if ( QUnit.jQuerySelectors || this.safari ) {
assert.deepEqual(
jQuery.find( ":nth-child(n)", null, null,
[ document.createElement( "a" ) ].concat( q( "ap" ) ) ),
@ -860,7 +868,7 @@ QUnit.test( "pseudo - nth-last-child", function( assert ) {
assert.t( "Nth-last-child(-n+3)", "#form #select1 option:nth-last-child(-n+3)", [ "option1b", "option1c", "option1d" ] );
assert.t( "Nth-last-child(-1n + 3)", "#form #select1 option:nth-last-child(-1n + 3)", [ "option1b", "option1c", "option1d" ] );
if ( jQuery.find.compile || this.safari ) {
if ( QUnit.jQuerySelectors || this.safari ) {
assert.deepEqual(
jQuery.find(
":nth-last-child(n)",
@ -905,7 +913,7 @@ QUnit.test( "pseudo - nth-last-of-type", function( assert ) {
assert.t( "Nth-last-of-type(-n+2)", "#qunit-fixture > :nth-last-of-type(-n+2)", [ "ap", "name+value", "first", "firstUL", "empty", "floatTest", "iframe", "table", "testForm", "disabled-tests", "siblingTest", "fx-test-group", "last" ] );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "pseudo - has", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "pseudo - has", function( assert ) {
assert.expect( 3 );
assert.t( "Basic test", "p:has(a)", [ "firstp", "ap", "en", "sap" ] );
@ -915,7 +923,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "pseudo - has", function( assert
[ "moretests", "t2037", "fx-test-group", "fx-queue" ] );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "pseudo - contains", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "pseudo - contains", function( assert ) {
assert.expect( 9 );
var gh335 = document.getElementById( "qunit-fixture" ).appendChild(
@ -947,7 +955,7 @@ QUnit.test( "pseudo - misc", function( assert ) {
jQuery( "<h1 id='h1'/><h2 id='h2'/><h2 id='h2-2'/>" ).prependTo( "#qunit-fixture" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Headers", "#qunit-fixture :header", [ "h1", "h2", "h2-2" ] );
assert.t( "Headers(case-insensitive)", "#qunit-fixture :Header", [ "h1", "h2", "h2-2" ] );
} else {
@ -955,7 +963,7 @@ QUnit.test( "pseudo - misc", function( assert ) {
assert.ok( "skip", ":header not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Multiple matches with the same context (cache check)",
"#form select:has(option:first-child:contains('o'))",
[ "select1", "select2", "select3", "select4" ]
@ -980,7 +988,7 @@ QUnit.test( "pseudo - misc", function( assert ) {
.replace( /%/g, type )
).appendTo( tmp );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Input Buttons :" + type, "#tmp_input :" + type, [ "input_" + type, "button_" + type ] );
assert.ok( jQuery( els[ 0 ] ).is( ":" + type ), "Input Matches :" + type );
@ -1053,7 +1061,7 @@ QUnit.test( "pseudo - misc", function( assert ) {
"caching system tolerates recursive selection"
);
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
// Tokenization edge cases
assert.t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code)", [ "ap" ] );
assert.t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code):contains(This link)", [ "ap" ] );
@ -1064,9 +1072,7 @@ QUnit.test( "pseudo - misc", function( assert ) {
assert.t( "Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=')']", [ "sndp" ] );
assert.t( "Multi-pseudo", "#ap:has(*), #ap:has(*)", [ "ap" ] );
assert.t( "Multi-positional", "#ap:gt(0), #ap:lt(1)", [ "ap" ] );
assert.t( "Multi-pseudo with leading nonexistent id", "#nonexistent:has(*), #ap:has(*)", [ "ap" ] );
assert.t( "Multi-positional with leading nonexistent id", "#nonexistent:gt(0), #ap:lt(1)", [ "ap" ] );
assert.t( "Tokenization stressor", "a[class*=blog]:not(:has(*, :contains(!)), :contains(!)), br:contains(]), p:contains(]), :not(:empty):not(:parent)", [ "ap", "mark", "yahoo", "simon" ] );
} else {
@ -1079,12 +1085,18 @@ QUnit.test( "pseudo - misc", function( assert ) {
assert.ok( "skip", ":contains not supported in selector-native" );
assert.ok( "skip", ":has not supported in selector-native" );
assert.ok( "skip", ":lt & :gt not supported in selector-native" );
assert.ok( "skip", ":has supported in selector-native" );
assert.ok( "skip", ":lt & :gt not supported in selector-native" );
assert.ok( "skip", ":has not supported in selector-native" );
}
if ( QUnit.jQuerySelectorsPos ) {
assert.t( "Multi-positional", "#ap:gt(0), #ap:lt(1)", [ "ap" ] );
assert.t( "Multi-positional with leading nonexistent id", "#nonexistent:gt(0), #ap:lt(1)", [ "ap" ] );
} else {
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
} );
QUnit.test( "pseudo - :not", function( assert ) {
@ -1092,22 +1104,24 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.t( "Not", "a.blog:not(.link)", [ "mark" ] );
if ( jQuery.find.compile ) {
assert.t( ":not() with :first", "#foo p:not(:first) .link", [ "simon" ] );
if ( QUnit.jQuerySelectors ) {
assert.t( "Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", [ "option1c", "option1d", "option2b", "option2c", "option3d", "option3e", "option4e", "option5b", "option5c" ] );
assert.t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c" ] );
} else {
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", ":contains not supported in selector-native" );
assert.ok( "skip", ":selected not supported in selector-native" );
}
if ( QUnit.jQuerySelectorsPos ) {
assert.t( ":not() with :first", "#foo p:not(:first) .link", [ "simon" ] );
} else {
assert.ok( "skip", "Positional selectors are not supported" );
}
assert.t( ":not() failing interior", "#qunit-fixture p:not(.foo)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
assert.t( ":not() failing interior", "#qunit-fixture p:not(#blargh)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
if ( jQuery.find.compile || this.safari ) {
if ( QUnit.jQuerySelectors || this.safari ) {
assert.t( ":not() failing interior", "#qunit-fixture p:not(div.foo)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
assert.t( ":not() failing interior", "#qunit-fixture p:not(p.foo)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
assert.t( ":not() failing interior", "#qunit-fixture p:not(div#blargh)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
@ -1126,7 +1140,7 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.t( ":not Multiple", "#qunit-fixture p:not( p )", [] );
assert.t( ":not Multiple", "p:not(p)", [] );
if ( jQuery.find.compile || this.safari ) {
if ( QUnit.jQuerySelectors || this.safari ) {
assert.t( ":not Multiple", "#qunit-fixture p:not(a, b)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
assert.t( ":not Multiple", "#qunit-fixture p:not(a, b, div)", [ "firstp", "ap", "sndp", "en", "sap", "first" ] );
assert.t( ":not Multiple", "p:not(a,p)", [] );
@ -1142,7 +1156,7 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.ok( "skip", ":not(complex selector) not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( ":not Multiple", ":input:not(:image,:input,:submit)", [] );
assert.t( ":not Multiple", "#qunit-fixture p:not(:has(a), :nth-child(1))", [ "first" ] );
} else {
@ -1159,7 +1173,7 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.t( ":not() Multiple Class", "#foo a:not(.blog)", [ "yahoo", "anchor2" ] );
assert.t( ":not() Multiple Class", "#foo a:not(.link)", [ "yahoo", "anchor2" ] );
if ( jQuery.find.compile || this.safari ) {
if ( QUnit.jQuerySelectors || this.safari ) {
assert.t( ":not() Multiple Class", "#foo a:not(.blog.link)", [ "yahoo", "anchor2" ] );
} else {
// Support: Chrome 75+, Firefox 67+
@ -1167,7 +1181,7 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.ok( "skip", ":not(complex selector) not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( ":not chaining (compound)", "#qunit-fixture div[id]:not(:has(div, span)):not(:has(*))", [ "nothiddendivchild", "divWithNoTabIndex", "fx-tests" ] );
assert.t( ":not chaining (with attribute)", "#qunit-fixture form[id]:not([action$='formaction']):not(:button)", [ "lengthtest", "name-tests", "testForm", "disabled-tests" ] );
assert.t( ":not chaining (colon in attribute)", "#qunit-fixture form[id]:not([action='form:action']):not(:button)", [ "form", "lengthtest", "name-tests", "testForm", "disabled-tests" ] );
@ -1181,7 +1195,7 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.ok( "skip", ":contains not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
assert.t( "positional :not()", "#foo p:not(:last)", [ "sndp", "en" ] );
assert.t( "positional :not() prefix", "#foo p:not(:last) a", [ "yahoo" ] );
assert.t( "compound positional :not()", "#foo p:not(:first, :last)", [ "en" ] );
@ -1194,21 +1208,21 @@ QUnit.test( "pseudo - :not", function( assert ) {
assert.t( "positional :not() with pre-filter", "#foo p:not([lang]:first)", [ "sndp", "sap" ] );
assert.t( "positional :not() with post-filter", "#foo p:not(:first[lang])", [ "sndp", "en", "sap" ] );
} else {
assert.ok( "skip", ":last not supported in selector-native" );
assert.ok( "skip", ":last not supported in selector-native" );
assert.ok( "skip", ":first, :last not supported in selector-native" );
assert.ok( "skip", ":first, :even not supported in selector-native" );
assert.ok( "skip", ":first, :odd not supported in selector-native" );
assert.ok( "skip", ":first, :odd not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", ":first not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
assert.ok( "skip", "Positional selectors are not supported" );
}
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "pseudo - position", function( assert ) {
QUnit[ QUnit.jQuerySelectorsPos ? "test" : "skip" ]( "pseudo - position", function( assert ) {
assert.expect( 34 );
assert.t( "First element", "#qunit-fixture p:first", [ "firstp" ] );
@ -1262,7 +1276,7 @@ QUnit.test( "pseudo - form", function( assert ) {
var extraTexts = jQuery( "<input id=\"impliedText\"/><input id=\"capitalText\" type=\"TEXT\">" ).appendTo( "#form" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Form element :radio", "#form :radio", [ "radio1", "radio2" ] );
assert.t( "Form element :checkbox", "#form :checkbox", [ "check1", "check2" ] );
assert.t( "Form element :text", "#form :text", [ "text1", "text2", "hidden2", "name", "impliedText", "capitalText" ] );
@ -1278,7 +1292,7 @@ QUnit.test( "pseudo - form", function( assert ) {
assert.ok( "skip", ":radio not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Selected option element",
"#form option:selected",
[ "option1a", "option2d", "option3b", "option3c", "option4b", "option4c", "option4d",
@ -1295,7 +1309,7 @@ QUnit.test( "pseudo - form", function( assert ) {
assert.ok( "skip", ":selected not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.t( "Form element :input", "#form :input", [ "text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3", "select4", "select5", "impliedText", "capitalText" ] );
// trac-12600
@ -1345,7 +1359,7 @@ QUnit.test( "pseudo - :(dis|en)abled, explicitly disabled", function( assert ) {
"disabled-select", "disabled-optgroup", "disabled-option" ]
);
if ( jQuery.find.compile || !this.chrome ) {
if ( QUnit.jQuerySelectors || !this.chrome ) {
// Support: Chrome 75+
// Chrome recognizes anchor elements as enabled.
assert.t(
@ -1355,7 +1369,7 @@ QUnit.test( "pseudo - :(dis|en)abled, explicitly disabled", function( assert ) {
"enabled-select", "enabled-optgroup", "enabled-option" ]
);
} else {
assert.ok( true, ":enabled broken in Chrome in selector-native" );
assert.ok( "skip", ":enabled broken in Chrome in selector-native" );
}
} );
@ -1419,7 +1433,7 @@ QUnit.test( "pseudo - :target and :root", function( assert ) {
} );
QUnit.test( "pseudo - :lang", function( assert ) {
assert.expect( jQuery.find.compile ? 105 : 55 );
assert.expect( QUnit.jQuerySelectors ? 105 : 55 );
var docElem = document.documentElement,
docXmlLang = docElem.getAttribute( "xml:lang" ),
@ -1498,7 +1512,7 @@ QUnit.test( "pseudo - :lang", function( assert ) {
jQuery.find( "#qunit-fixture:lang(c++)" );
}, ":lang value must be a valid identifier" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
// XML
foo = jQuery( "response", xml )[ 0 ];
@ -1543,7 +1557,7 @@ QUnit.test( "context", function( assert ) {
expected = [ iframeDoc.getElementById( "foo" ) ];
assert.deepEqual( jQuery.find( "p", iframeDoc ), expected, "Other document context (simple)" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual( jQuery.find( "p:contains(ar)", iframeDoc ), expected,
"Other document context (complex)" );
} else {
@ -1558,7 +1572,7 @@ QUnit.test( "context", function( assert ) {
context = document.getElementById( "nothiddendiv" );
assert.deepEqual( jQuery.find( "*", context ), q( "nothiddendivchild" ), "<div> context" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual( jQuery.find( "* > *", context ), [], "<div> context (no results)" );
} else {
assert.ok( "skip", "The whole selector not required to be under context in selector-native" );
@ -1567,7 +1581,7 @@ QUnit.test( "context", function( assert ) {
context.removeAttribute( "id" );
assert.deepEqual( jQuery.find( "*", context ), q( "nothiddendivchild" ), "no-id element context" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual( jQuery.find( "* > *", context ), [], "no-id element context (no results)" );
} else {
assert.ok( "skip", ":contains not supported in selector-native" );
@ -1591,7 +1605,7 @@ QUnit.test( "context", function( assert ) {
expected = q( "siblingnext", "siblingspan" );
context.appendChild( document.getElementById( "siblingTest" ) );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual(
jQuery.find( "em:nth-child(2)", context ),
expected.slice( 0, 1 ),
@ -1606,7 +1620,7 @@ QUnit.test( "context", function( assert ) {
assert.ok( "skip", "selection on document fragments not supported in selector-native" );
}
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.deepEqual(
jQuery.find( "em + :not(:has(*)):not(:empty), foo", context.firstChild ),
expected.slice( 0, 1 ),
@ -1629,12 +1643,12 @@ QUnit.test( "caching does not introduce bugs", function( assert ) {
"Reusing selector with new context"
);
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectorsPos ) {
assert.t( "Deep ancestry caching in post-positional element matcher (jQuery #14657)",
"#qunit-fixture a:lt(3):parent",
[ "simon1", "google", "groups" ] );
} else {
assert.ok( "skip", ":lt not supported in selector-native" );
assert.ok( "skip", "Positional selectors are not supported" );
}
sap.className = "original";
@ -1653,7 +1667,7 @@ QUnit.test( "disconnected nodes", function( assert ) {
assert.equal( $div.is( "div" ), true, "Make sure .is('nodeName') works on disconnected nodes." );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "disconnected nodes", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "disconnected nodes", function( assert ) {
assert.expect( 3 );
var $opt = jQuery( "<option></option>" ).attr( "value", "whipit" ).appendTo( "#qunit-fixture" ).detach();
@ -1666,7 +1680,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "disconnected nodes", function(
// Support: IE 11+, Edge 12 - 18+
// IE/Edge don't support Shadow DOM.
// selector-native doesn't support querying inside of Shadow DOM.
QUnit[ jQuery.find.compile && document.body.getRootNode ? "test" : "skip" ](
QUnit[ QUnit.jQuerySelectors && document.body.getRootNode ? "test" : "skip" ](
"Shadow DOM nodes supported as root", function( assert ) {
assert.expect( 2 );
@ -1810,7 +1824,7 @@ QUnit.test( "jQuery.contains in SVG (jQuery trac-10832)", function( assert ) {
} );
QUnit.test( "jQuery.uniqueSort", function( assert ) {
assert.expect( 15 );
assert.expect( 14 );
function Arrayish( arr ) {
var i = this.length = arr.length;
@ -1886,8 +1900,6 @@ QUnit.test( "jQuery.uniqueSort", function( assert ) {
assert.deepEqual( jQuery.uniqueSort( test.input ).slice( 0, length ), test.expected, label + " (array)" );
assert.deepEqual( jQuery.uniqueSort( new Arrayish( test.input ) ).slice( 0, length ), test.expected, label + " (quasi-array)" );
} );
assert.strictEqual( jQuery.unique, jQuery.uniqueSort, "jQuery.unique() is an alias for jQuery.uniqueSort()" );
} );
testIframe(
@ -1902,7 +1914,7 @@ testIframe(
testIframe(
"jQuery selector cache collides with multiple jQueries on a page",
"selector/sizzle_cache.html",
"selector/cache.html",
function( assert, jQuery, window, document ) {
var $cached = window.$cached;

View File

@ -13,7 +13,7 @@ QUnit.test( "find(String) under non-elements", function( assert ) {
assert.equal( j.find( "div" ).addBack().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "find(leading combinator)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "find(leading combinator)", function( assert ) {
assert.expect( 4 );
assert.deepEqual( jQuery( "#qunit-fixture" ).find( "> div" ).get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
@ -104,7 +104,7 @@ QUnit.test( "is(String)", function( assert ) {
assert.ok( jQuery( input ).is( "input[data-pos=':first']" ),
"attribute-equals POS in string" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.ok( jQuery( input ).is( ":input[data-pos=':first']" ),
"attribute-equals POS in string after pseudo" );
} else {
@ -115,7 +115,7 @@ QUnit.test( "is(String)", function( assert ) {
assert.ok( jQuery( option ).is( "[id=option1a]" ),
"id attribute-equals identifier" );
if ( jQuery.find.compile ) {
if ( QUnit.jQuerySelectors ) {
assert.ok( jQuery( option ).is( "[id*=option1][type!=checkbox]" ),
"attribute-not-equals identifier" );
} else {
@ -185,7 +185,7 @@ QUnit.test( "is(jQuery)", function( assert ) {
assert.ok( !jQuery( "#simon" ).is( jQuery( ".blogTest" )[ 0 ] ), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "is() with :has() selectors", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "is() with :has() selectors", function( assert ) {
assert.expect( 6 );
assert.ok( jQuery( "#foo" ).is( ":has(p)" ), "Check for child: Expected a child 'p' element" );
@ -197,7 +197,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "is() with :has() selectors", fu
assert.ok( !jQuery( "#foo" ).is( jQuery( "div:has(ul)" ) ), "Check for child: Did not expect 'ul' element" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "is() with positional selectors", function( assert ) {
QUnit[ QUnit.jQuerySelectorsPos ? "test" : "skip" ]( "is() with positional selectors", function( assert ) {
assert.expect( 27 );
var
@ -334,7 +334,7 @@ QUnit.test( "filter(jQuery)", function( assert ) {
assert.deepEqual( jQuery( "#form input" ).filter( elements ).get(), q( "text1" ), "filter(Element)" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "filter() with positional selectors", function( assert ) {
QUnit[ QUnit.jQuerySelectorsPos ? "test" : "skip" ]( "filter() with positional selectors", function( assert ) {
assert.expect( 19 );
var filterit = function( sel, filter, length ) {
@ -415,7 +415,7 @@ QUnit.test( "closest()", function( assert ) {
assert.deepEqual( jq.contents().closest( "*" ).get(), jq.get(), "Text node input (#13332)" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "closest() with positional selectors", function( assert ) {
QUnit[ QUnit.jQuerySelectorsPos ? "test" : "skip" ]( "closest() with positional selectors", function( assert ) {
assert.expect( 3 );
assert.deepEqual( jQuery( "#qunit-fixture" ).closest( "div:first" ).get(), [],
@ -445,7 +445,7 @@ QUnit.test( "closest(jQuery)", function( assert ) {
assert.ok( $child.closest( $body.add( $parent ) ).is( "#nothiddendiv" ), "Closest ancestor retrieved." );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "not(Selector)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "not(Selector)", function( assert ) {
assert.expect( 7 );
assert.equal( jQuery( "#qunit-fixture > p#ap > a" ).not( "#google" ).length, 2, "not('selector')" );
@ -525,7 +525,7 @@ QUnit.test( "not(jQuery)", function( assert ) {
);
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "not(Selector) excludes non-element nodes (gh-2808)", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "not(Selector) excludes non-element nodes (gh-2808)", function( assert ) {
assert.expect( 3 );
var mixedContents = jQuery( "#nonnodes" ).contents(),
@ -628,7 +628,7 @@ QUnit.test( "siblings([String])", function( assert ) {
assert.equal( jQuery( "<a/>" ).siblings().length, 0, "Detached elements have no siblings (#11370)" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "siblings([String])", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "siblings([String])", function( assert ) {
assert.expect( 2 );
assert.deepEqual( jQuery( "#sndp" ).siblings( ":has(code)" ).get(), q( "sap" ), "Check for filtered siblings (has code child element)" );
assert.deepEqual( jQuery( "#sndp" ).siblings( ":has(a)" ).get(), q( "en", "sap" ), "Check for filtered siblings (has anchor child element)" );
@ -640,7 +640,7 @@ QUnit.test( "children([String])", function( assert ) {
assert.deepEqual( jQuery( "#foo" ).children( "#en, #sap" ).get(), q( "en", "sap" ), "Check for multiple filters" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "children([String])", function( assert ) {
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "children([String])", function( assert ) {
assert.expect( 1 );
assert.deepEqual( jQuery( "#foo" ).children( ":has(code)" ).get(), q( "sndp", "sap" ), "Check for filtered children" );
} );