mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Selector: Inline Sizzle into the selector module: 3.x version (#5113)
This commit removes Sizzle from jQuery, inlining its code & removing obsolete workarounds where applicable. 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 main `selector` module can be disabled in favor of `selector-native` via: grunt custom:-selector For backwards compatibility, the legacy `sizzle` alias is also supported (it will be dropped in jQuery `4.0.0`): grunt custom:-selector Sizzle tests have been ported to jQuery ones. Ones that are not compatible with the `selector-native` module are disabled if the regular selector module is excluded. Backwards compatibility is still kept for all `Sizzle` utils - they continue to be available under `jQuery.find` - but the primary implementation is now attached directly to jQuery. Some selector utils shared by `selector` & `selector-native` have been extracted & deduplicated. `jQuery.text` and `jQuery.isXMLDoc` have been moved to the `core` module. The commit reduces the gzipped jQuery size by 851 bytes compared to the `3.x-stable` branch. Closes gh-5113 Ref gh-4395 Ref gh-4406
This commit is contained in:
parent
96675fa7c8
commit
6306ca4994
4
.github/workflows/node.js.yml
vendored
4
.github/workflows/node.js.yml
vendored
@ -28,9 +28,9 @@ jobs:
|
||||
NODE_VERSION: "16.x"
|
||||
NPM_SCRIPT: "test:no-deprecated"
|
||||
BROWSERS: "ChromeHeadless"
|
||||
- NAME: "Browser tests: no-Sizzle build, Chrome stable"
|
||||
- NAME: "Browser tests: selector-native build, Chrome stable"
|
||||
NODE_VERSION: "16.x"
|
||||
NPM_SCRIPT: "test:no-sizzle"
|
||||
NPM_SCRIPT: "test:selector-native"
|
||||
BROWSERS: "ChromeHeadless"
|
||||
- NAME: "Browser tests: AMD build, Chrome stable"
|
||||
NODE_VERSION: "16.x"
|
||||
|
181
AUTHORS.txt
181
AUTHORS.txt
@ -18,16 +18,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>
|
||||
@ -35,9 +43,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>
|
||||
@ -45,23 +54,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>
|
||||
@ -71,21 +81,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>
|
||||
@ -105,12 +113,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>
|
||||
@ -122,6 +131,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>
|
||||
@ -130,164 +140,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>
|
||||
@ -295,31 +321,36 @@ 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>
|
||||
Pat O'Callaghan <patocallaghan@gmail.com>
|
||||
Ahmed.S.ElAfifi <ahmed.s.elafifi@gmail.com>
|
||||
Hoang <dangkyokhoang@gmail.com>
|
||||
Wonseop Kim <wonseop.kim@samsung.com>
|
||||
Pat O'Callaghan <patocallaghan@gmail.com>
|
||||
JuanMa Ruiz <ruizjuanma@gmail.com>
|
||||
Ahmed.S.ElAfifi <ahmed.s.elafifi@gmail.com>
|
||||
Christian Oliff <christianoliff@pm.me>
|
||||
Christian Wenz <christian@wenz.org>
|
||||
Sean Robinson <sean.robinson@scottsdalecc.edu>
|
||||
|
@ -61,8 +61,7 @@ module.exports = function( grunt ) {
|
||||
all: {
|
||||
dest: "dist/jquery.js",
|
||||
minimum: [
|
||||
"core",
|
||||
"selector"
|
||||
"core"
|
||||
],
|
||||
|
||||
// Exclude specified modules if the module matching the key is removed
|
||||
@ -76,7 +75,7 @@ module.exports = function( grunt ) {
|
||||
include: [ "core/ready-no-deferred" ]
|
||||
},
|
||||
event: [ "deprecated/ajax-event-alias", "deprecated/event" ],
|
||||
sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
|
||||
selector: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -86,9 +85,6 @@ module.exports = function( grunt ) {
|
||||
destPrefix: "external"
|
||||
},
|
||||
files: {
|
||||
"sizzle/dist": "sizzle/dist",
|
||||
"sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
|
||||
|
||||
"core-js/core-js.js": "core-js/client/core.min.js",
|
||||
"core-js/LICENSE.txt": "core-js/LICENSE",
|
||||
|
||||
|
10
README.md
10
README.md
@ -106,11 +106,13 @@ 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`.
|
||||
As a special case, you may also replace the full jQuery `selector` module by using a special flag `grunt custom:-selector`.
|
||||
|
||||
- **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/main/src/selector-native.js) file for details.
|
||||
- **selector**: The full jQuery 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/main/src/selector-native.js) file for details.
|
||||
|
||||
*Note*: Excluding Sizzle will also exclude all jQuery selector extensions (such as `effects/animatedSelector` and `css/hiddenVisibleSelectors`).
|
||||
For backwards compatibility purposes, the name `sizzle` is recognized as the alias for `selector`.
|
||||
|
||||
*Note*: Excluding the full `selector` module 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.
|
||||
|
||||
@ -167,7 +169,7 @@ There is also a special alias to generate a build with the same configuration as
|
||||
grunt custom:slim
|
||||
```
|
||||
|
||||
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
|
||||
--------------------------------------
|
||||
|
@ -18,7 +18,6 @@ module.exports = function( Release ) {
|
||||
];
|
||||
const cdn = require( "./release/cdn" );
|
||||
const dist = require( "./release/dist" );
|
||||
const ensureSizzle = require( "./release/ensure-sizzle" );
|
||||
|
||||
const npmTags = Release.npmTags;
|
||||
|
||||
@ -26,14 +25,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
|
||||
*/
|
||||
|
@ -69,7 +69,6 @@ module.exports = function( Release, files, complete ) {
|
||||
|
||||
// Copy dist files
|
||||
const distFolder = `${ Release.dir.dist }/dist`;
|
||||
const externalFolder = `${ Release.dir.dist }/external`;
|
||||
const readme = await fs.readFile(
|
||||
`${ Release.dir.repo }/build/fixtures/README.md`, "utf8" );
|
||||
const rmIgnore = [ ...files, "node_modules" ]
|
||||
@ -93,10 +92,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 );
|
||||
|
@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var fs = require( "fs" ),
|
||||
chalk = require( "chalk" ),
|
||||
sizzleLoc = __dirname + "/../../external/sizzle/dist/sizzle.js",
|
||||
rversion = /Engine v(\d+\.\d+\.\d+(?:-[-\.\d\w]+)?)/;
|
||||
|
||||
/**
|
||||
* 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..." );
|
||||
var match = rversion.exec( fs.readFileSync( sizzleLoc, "utf8" ) ),
|
||||
version = match ? match[ 1 ] : "Not Found",
|
||||
latest = Release.exec( {
|
||||
command: "npm info sizzle version",
|
||||
silent: true
|
||||
} );
|
||||
|
||||
if ( version !== latest ) {
|
||||
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;
|
@ -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
|
||||
@ -101,7 +94,7 @@ module.exports = function( grunt ) {
|
||||
|
||||
// Remove empty definitions
|
||||
contents = contents
|
||||
.replace( /define\(\[[^\]]*\]\)[\W\n]+$/, "" );
|
||||
.replace( /define\(\s*\[[^\]]*\]\s*\)[\W\n]+$/, "" );
|
||||
}
|
||||
|
||||
// AMD Name
|
||||
@ -178,14 +171,19 @@ module.exports = function( grunt ) {
|
||||
* Adds the specified module to the excluded or included list, depending on the flag
|
||||
* @param {String} flag A module path relative to
|
||||
* the src directory starting with + or - to indicate
|
||||
* whether it should included or excluded
|
||||
* whether it should be included or excluded
|
||||
*/
|
||||
excluder = function( flag ) {
|
||||
var additional,
|
||||
m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ),
|
||||
m = /^(\+|-|)([\w\/-]+)$/.exec( flag ),
|
||||
exclude = m[ 1 ] === "-",
|
||||
module = m[ 2 ];
|
||||
|
||||
// Recognize the legacy `sizzle` alias
|
||||
if ( module === "sizzle" ) {
|
||||
module = "selector";
|
||||
}
|
||||
|
||||
if ( exclude ) {
|
||||
|
||||
// Can't exclude certain modules
|
||||
@ -200,7 +198,16 @@ module.exports = function( grunt ) {
|
||||
// These are the removable dependencies
|
||||
// It's fine if the directory is not there
|
||||
try {
|
||||
excludeList( fs.readdirSync( srcFolder + module ), module );
|
||||
|
||||
// `selector` is a special case as we don't just remove
|
||||
// the module, but we replace it with `selector-native`
|
||||
// which re-uses parts of the `src/selector` folder.
|
||||
if ( module !== "selector" ) {
|
||||
excludeList(
|
||||
fs.readdirSync( `${ srcFolder }/${ module }` ),
|
||||
module
|
||||
);
|
||||
}
|
||||
} catch ( e ) {
|
||||
grunt.verbose.writeln( e );
|
||||
}
|
||||
@ -218,11 +225,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,17 +261,16 @@ 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 );
|
||||
// Handle full selector module exclusion.
|
||||
// Replace with selector-native.
|
||||
if ( excluded.indexOf( "selector" ) > -1 ) {
|
||||
config.rawText.selector = "define([ \"./selector-native\" ]);";
|
||||
}
|
||||
|
||||
// Replace exports/global with a noop noConflict
|
||||
if ( ( index = excluded.indexOf( "exports/global" ) ) > -1 ) {
|
||||
config.rawText[ "exports/global" ] = "define(['../core']," +
|
||||
"function( jQuery ) {\njQuery.noConflict = function() {};\n});";
|
||||
config.rawText[ "exports/global" ] = "define( [\n\t\"../core\"\n], " +
|
||||
"function( jQuery ) {\n\tjQuery.noConflict = function() {};\n} );";
|
||||
excluded.splice( index, 1 );
|
||||
}
|
||||
|
||||
@ -311,9 +312,11 @@ module.exports = function( grunt ) {
|
||||
if ( !optIn ) {
|
||||
|
||||
// Overwrite the default inclusions with the explicit ones provided
|
||||
config.rawText.jquery = "define([" +
|
||||
( included.length ? included.join( "," ) : "" ) +
|
||||
"]);";
|
||||
config.rawText.jquery = "define( [\n" +
|
||||
( included.length ?
|
||||
included.map( module => "\t\"./" + module + "\"" ).join( ",\n" ) :
|
||||
"" ) +
|
||||
"\n] );";
|
||||
}
|
||||
|
||||
// Trace dependencies and concatenate files
|
||||
|
15
dist/.eslintrc.json
vendored
15
dist/.eslintrc.json
vendored
@ -14,20 +14,7 @@
|
||||
"rules": {
|
||||
// That is okay for the built version
|
||||
"no-multiple-empty-lines": "off",
|
||||
"one-var": "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"
|
||||
"one-var": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
36
external/sizzle/LICENSE.txt
vendored
36
external/sizzle/LICENSE.txt
vendored
@ -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.
|
2543
external/sizzle/dist/sizzle.js
vendored
2543
external/sizzle/dist/sizzle.js
vendored
File diff suppressed because it is too large
Load Diff
3
external/sizzle/dist/sizzle.min.js
vendored
3
external/sizzle/dist/sizzle.min.js
vendored
File diff suppressed because one or more lines are too long
1
external/sizzle/dist/sizzle.min.map
vendored
1
external/sizzle/dist/sizzle.min.map
vendored
File diff suppressed because one or more lines are too long
@ -61,7 +61,6 @@
|
||||
"raw-body": "2.3.3",
|
||||
"requirejs": "2.3.6",
|
||||
"sinon": "2.3.7",
|
||||
"sizzle": "2.3.8",
|
||||
"strip-json-comments": "2.0.1",
|
||||
"testswarm": "1.1.2",
|
||||
"uglify-js": "3.4.7"
|
||||
@ -73,9 +72,9 @@
|
||||
"test:browser": "grunt && grunt karma:main",
|
||||
"test:amd": "grunt && grunt karma:amd",
|
||||
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
|
||||
"test:no-sizzle": "grunt test:prepare && grunt custom:-sizzle && grunt karma:main",
|
||||
"test:selector-native": "grunt test:prepare && grunt custom:-selector && grunt karma:main",
|
||||
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
|
||||
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:no-sizzle && grunt && grunt test:slow && grunt karma:main && grunt karma:amd",
|
||||
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:selector-native && grunt && grunt test:slow && grunt karma:main && grunt karma:amd",
|
||||
"jenkins": "npm run test:browserless"
|
||||
},
|
||||
"commitplease": {
|
||||
|
@ -33,6 +33,13 @@
|
||||
"globals": {
|
||||
"jQuery": false
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"files": "selector.js",
|
||||
"rules": {
|
||||
"indent": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
41
src/core.js
41
src/core.js
@ -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 ) {
|
||||
@ -272,6 +273,33 @@ 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 ) {
|
||||
return elem.textContent;
|
||||
} else if ( nodeType === 3 || nodeType === 4 ) {
|
||||
return elem.nodeValue;
|
||||
}
|
||||
|
||||
// Do not include comment or processing instruction nodes
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
// results is for internal usage only
|
||||
makeArray: function( arr, results ) {
|
||||
var ret = results || [];
|
||||
@ -294,6 +322,15 @@ jQuery.extend( {
|
||||
return arr == null ? -1 : indexOf.call( arr, elem, i );
|
||||
},
|
||||
|
||||
isXMLDoc: function( elem ) {
|
||||
var namespace = elem && elem.namespaceURI,
|
||||
docElem = elem && ( 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" );
|
||||
},
|
||||
|
||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
||||
// push.apply(_, arraylike) throws on ancient WebKit
|
||||
merge: function( first, second ) {
|
||||
|
@ -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
7
src/core/var/rhtml.js
Normal file
@ -0,0 +1,7 @@
|
||||
define( function() {
|
||||
|
||||
"use strict";
|
||||
|
||||
return ( /HTML$/i );
|
||||
|
||||
} );
|
@ -248,7 +248,8 @@ jQuery.extend( {
|
||||
if ( !support.noCloneChecked && ( 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 );
|
||||
|
||||
|
@ -3,63 +3,46 @@ define( [
|
||||
"./var/document",
|
||||
"./var/documentElement",
|
||||
"./var/hasOwn",
|
||||
"./var/indexOf"
|
||||
"./var/indexOf",
|
||||
|
||||
// The following utils are attached directly to the jQuery object.
|
||||
"./selector/contains",
|
||||
"./selector/escapeSelector"
|
||||
], function( jQuery, document, documentElement, hasOwn, indexOf ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Optional (non-Sizzle) selector module for custom builds.
|
||||
* Optional limited 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
|
||||
* * 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 jQuery 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)
|
||||
* * 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.
|
||||
* If any of these are unacceptable tradeoffs, either use the full
|
||||
* selector engine 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,
|
||||
matches = documentElement.matches ||
|
||||
documentElement.webkitMatchesSelector ||
|
||||
documentElement.mozMatchesSelector ||
|
||||
documentElement.oMatchesSelector ||
|
||||
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;
|
||||
};
|
||||
documentElement.msMatchesSelector;
|
||||
|
||||
function sortOrder( a, b ) {
|
||||
|
||||
@ -132,14 +115,16 @@ function uniqueSort( results ) {
|
||||
return results;
|
||||
}
|
||||
|
||||
function escape( sel ) {
|
||||
return ( sel + "" ).replace( rcssescape, fcssescape );
|
||||
}
|
||||
|
||||
jQuery.extend( {
|
||||
|
||||
// This method cannot be shared with the main selector module
|
||||
// as it does in 4.x because of an edge case quirk of putting
|
||||
// disconnected elements in the preferred document before other
|
||||
// elements in the full selector module. This will be a minor
|
||||
// breaking change in 4.0.0.
|
||||
uniqueSort: uniqueSort,
|
||||
unique: uniqueSort,
|
||||
escapeSelector: escape,
|
||||
|
||||
find: function( selector, context, results, seed ) {
|
||||
var elem, nodeType,
|
||||
i = 0;
|
||||
@ -147,13 +132,13 @@ jQuery.extend( {
|
||||
results = results || [];
|
||||
context = context || document;
|
||||
|
||||
// Same basic safeguard as Sizzle
|
||||
// Same basic safeguard as in the full selector module
|
||||
if ( !selector || typeof selector !== "string" ) {
|
||||
return results;
|
||||
}
|
||||
|
||||
// Early return if context is not an element or document
|
||||
if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 ) {
|
||||
// Early return if context is not an element, document or document fragment
|
||||
if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 && nodeType !== 11 ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -169,46 +154,6 @@ jQuery.extend( {
|
||||
|
||||
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 bup = b && b.parentNode;
|
||||
return a === bup || !!( bup && bup.nodeType === 1 && a.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: {
|
||||
|
@ -1,19 +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;
|
||||
|
||||
} );
|
2127
src/selector.js
2127
src/selector.js
File diff suppressed because it is too large
Load Diff
21
src/selector/contains.js
Normal file
21
src/selector/contains.js
Normal file
@ -0,0 +1,21 @@
|
||||
define( [
|
||||
"../core"
|
||||
], function( jQuery ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Note: an element does not contain itself
|
||||
jQuery.contains = function( a, b ) {
|
||||
var bup = b && b.parentNode;
|
||||
|
||||
return a === bup || !!( bup && bup.nodeType === 1 && (
|
||||
|
||||
// Support: IE 9 - 11+
|
||||
// IE doesn't have `contains` on SVG.
|
||||
a.contains ?
|
||||
a.contains( bup ) :
|
||||
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
|
||||
) );
|
||||
};
|
||||
|
||||
} );
|
31
src/selector/escapeSelector.js
Normal file
31
src/selector/escapeSelector.js
Normal 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 );
|
||||
};
|
||||
|
||||
} );
|
@ -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 ) ) ) {
|
||||
|
||||
|
9
src/var/pop.js
Normal file
9
src/var/pop.js
Normal file
@ -0,0 +1,9 @@
|
||||
define( [
|
||||
"./arr"
|
||||
], function( arr ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
return arr.pop;
|
||||
|
||||
} );
|
9
src/var/sort.js
Normal file
9
src/var/sort.js
Normal file
@ -0,0 +1,9 @@
|
||||
define( [
|
||||
"./arr"
|
||||
], function( arr ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
return arr.sort;
|
||||
|
||||
} );
|
9
src/var/splice.js
Normal file
9
src/var/splice.js
Normal file
@ -0,0 +1,9 @@
|
||||
define( [
|
||||
"./arr"
|
||||
], function( arr ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
return arr.splice;
|
||||
|
||||
} );
|
@ -2,9 +2,6 @@
|
||||
* jQuery JavaScript Library v@VERSION
|
||||
* https://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
|
@ -18,6 +18,7 @@
|
||||
"ajaxTest": false,
|
||||
"testIframe": false,
|
||||
"createDashboardXML": false,
|
||||
"createWithFriesXML": false,
|
||||
"createXMLFragment": false,
|
||||
"includesModule": false,
|
||||
"moduleTeardown": false,
|
||||
|
@ -1,8 +1,8 @@
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
Here are some [links] in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/" class="GROUPS">Google Groups (Link)</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
This link has <code id="code1"><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
@ -78,11 +78,11 @@
|
||||
<param name="p2" value="x2" />
|
||||
</object>
|
||||
|
||||
<span id="台北Táiběi"></span>
|
||||
<span id="台北Táiběi"><span id="台北Táiběi-child"></span></span>
|
||||
<span id="台北" lang="中文"></span>
|
||||
<span id="utf8class1" class="台北Táiběi 台北"></span>
|
||||
<span id="utf8class1" class="台北Táiběi 台北">"'台北Táiběi"'</span>
|
||||
<span id="utf8class2" class="台北"></span>
|
||||
<span id="foo:bar" class="foo:bar"></span>
|
||||
<span id="foo:bar" class="foo:bar"><span id="foo_descendant"></span></span>
|
||||
<span id="test.foo[5]bar" class="test.foo[5]bar"></span>
|
||||
|
||||
<foo_bar id="foobar">test element</foo_bar>
|
||||
@ -116,6 +116,11 @@ Z</textarea>
|
||||
<input type="radio" name="R1" value="2" />
|
||||
<input type="text" name="My Name" value="me" />
|
||||
<input type="reset" name="reset" value="NO" />
|
||||
<div class="empty-name-container">
|
||||
<div id="empty-name-parent">
|
||||
<input type="text" id="name-empty" name="" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<select name="S1">
|
||||
<option value="abc">ABC</option>
|
||||
<option value="abc">ABC</option>
|
||||
@ -163,7 +168,26 @@ Z</textarea>
|
||||
<div id="t6652">
|
||||
<div></div>
|
||||
</div>
|
||||
<div id="t12087">
|
||||
<input type="hidden" id="el12087" data-comma="0,1"/>
|
||||
</div>
|
||||
<div id="no-clone-exception"><object><embed></embed></object></div>
|
||||
<div id="names-group">
|
||||
<span id="name-is-example" name="example"></span>
|
||||
<span id="name-is-div" name="div"></span>
|
||||
</div>
|
||||
<div id="id-name-tests">
|
||||
<a id="tName1ID" name="tName1"><span></span></a>
|
||||
<a id="tName2ID" name="tName2"><span></span></a>
|
||||
<div id="tName1"><span id="tName1-span">C</span></div>
|
||||
</div>
|
||||
<div id="whitespace-lists">
|
||||
<input id="t15233-single" data-15233="foo"/>
|
||||
<input id="t15233-double" data-15233="foo bar"/>
|
||||
<input id="t15233-double-tab" data-15233="foo bar"/>
|
||||
<input id="t15233-double-nl" data-15233="foo
bar"/>
|
||||
<input id="t15233-triple" data-15233="foo bar baz"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tabindex-tests">
|
||||
@ -194,6 +218,53 @@ Z</textarea>
|
||||
<span id="liveSpan2"><a href="#" id="liveLink2"></a></span>
|
||||
</div>
|
||||
|
||||
<form id="disabled-tests">
|
||||
<fieldset id="disabled-fieldset" disabled="disabled">
|
||||
<a id="disabled-fieldset-a" href="#"></a>
|
||||
<input id="disabled-fieldset-input" name="disabled-fieldset-input" type="text" />
|
||||
<textarea id="disabled-fieldset-textarea" name="disabled-fieldset-textarea" ></textarea>
|
||||
<button id="disabled-fieldset-button" name="disabled-fieldset-button">Go</button>
|
||||
<!-- exclude <select> because IE6 is bugged and fails
|
||||
<select id="disabled-fieldset-select" name="disabled-fieldset-select"></select>
|
||||
-->
|
||||
<span id="disabled-fieldset-span">Neither enabled nor disabled</span>
|
||||
</fieldset>
|
||||
<fieldset id="enabled-fieldset">
|
||||
<a id="disabled-a" href="#" disabled="disabled"></a>
|
||||
<input id="disabled-input" name="disabled-input" type="text" disabled="disabled"/>
|
||||
<textarea id="disabled-textarea" name="disabled-textarea" disabled="disabled"></textarea>
|
||||
<button id="disabled-button" name="disabled-button" disabled="disabled">Go</button>
|
||||
<select id="disabled-select" name="disabled-select" disabled="disabled">
|
||||
<optgroup id="disabled-optgroup" label="and" disabled="disabled">
|
||||
<option id="disabled-option" disabled="disabled">Black</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<input id="enabled-input" name="enabled-input" type="text"/>
|
||||
<textarea id="enabled-textarea" name="enabled-textarea"></textarea>
|
||||
<button id="enabled-button" name="enabled-button">Go</button>
|
||||
<select id="enabled-select" name="enabled-select">
|
||||
<optgroup id="enabled-optgroup" label="and">
|
||||
<option id="enabled-option">Gold</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<span id="enabled-fieldset-span">Neither enabled nor disabled</span>
|
||||
</fieldset>
|
||||
<select id="disabled-select-inherit" name="disabled-select-inherit" disabled="disabled">
|
||||
<optgroup id="disabled-optgroup-inherit" label="and" disabled="disabled">
|
||||
<option id="disabled-optgroup-option">Black</option>
|
||||
</optgroup>
|
||||
<optgroup id="enabled-optgroup-inherit" label="and">
|
||||
<option id="enabled-optgroup-option">Gold</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<select id="enabled-select-inherit" name="enabled-select-inherit">
|
||||
<optgroup id="en_disabled-optgroup-inherit" label="and" disabled="disabled">
|
||||
<option id="en_disabled-optgroup-option">Black</option>
|
||||
</optgroup>
|
||||
<option id="enabled-select-option">Black</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<div id="siblingTest">
|
||||
<em id="siblingfirst">1</em>
|
||||
<em id="siblingnext">2</em>
|
||||
@ -208,7 +279,7 @@ Z</textarea>
|
||||
</div>
|
||||
<div id="fx-test-group" style="position: absolute; width: 1px; height: 1px; overflow: hidden;">
|
||||
<div id="fx-queue" name="test">
|
||||
<div id="fadein" class='chain-test' name='div'>fadeIn<div>fadeIn</div></div>
|
||||
<div id="fadein" class='chain-test'>fadeIn<div>fadeIn</div></div>
|
||||
<div id="fadeout" class='chain-test chain-test-out'>fadeOut<div>fadeOut</div></div>
|
||||
|
||||
<div id="show" class='chain-test'>show<div>show</div></div>
|
||||
@ -235,3 +306,4 @@ Z</textarea>
|
||||
<div id="fx-tests"></div>
|
||||
<span id="display"></span>
|
||||
</div>
|
||||
<br id="last"/>
|
||||
|
@ -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>
|
22
test/data/selector/mixed_sort.html
Normal file
22
test/data/selector/mixed_sort.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>jQuery selector - cross-window uniqueSort</title>
|
||||
|
||||
<script src="../../jquery.js"></script>
|
||||
<script src="../iframeTest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var doc = parent.document,
|
||||
unframed = [ doc.getElementById( "qunit-fixture" ), doc.body, doc.documentElement ],
|
||||
framed = jQuery.find( "*" );
|
||||
|
||||
startIframeTest(
|
||||
jQuery.uniqueSort( unframed.concat( framed ) ),
|
||||
framed.concat( unframed.slice(0).reverse() )
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,7 @@
|
||||
/* eslint no-multi-str: "off" */
|
||||
|
||||
"use strict";
|
||||
|
||||
var FILEPATH = "/test/data/testinit.js",
|
||||
activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
|
||||
parentUrl = activeScript && activeScript.src ?
|
||||
@ -49,28 +51,22 @@ 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"]);
|
||||
*/
|
||||
function match( message, selector, expectedIds, context, assert ) {
|
||||
var f = jQuery( selector, context ).get(),
|
||||
s = "",
|
||||
i = 0;
|
||||
var elems = jQuery( selector, context ).get();
|
||||
|
||||
for ( ; i < f.length; i++ ) {
|
||||
s += ( s && "," ) + "\"" + f[ i ].id + "\"";
|
||||
}
|
||||
|
||||
assert.deepEqual( f, q.apply( q, expectedIds ), message + " (" + selector + ")" );
|
||||
assert.deepEqual( elems, q.apply( q, expectedIds ), message + " (" + selector + ")" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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"]);
|
||||
*/
|
||||
@ -82,7 +78,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"]);
|
||||
*/
|
||||
@ -106,6 +102,36 @@ this.createDashboardXML = function() {
|
||||
return jQuery.parseXML( string );
|
||||
};
|
||||
|
||||
this.createWithFriesXML = function() {
|
||||
var string = "<?xml version='1.0' encoding='UTF-8'?> \
|
||||
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' \
|
||||
xmlns:xsd='http://www.w3.org/2001/XMLSchema' \
|
||||
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> \
|
||||
<soap:Body> \
|
||||
<jsconf xmlns='http://www.example.com/ns1'> \
|
||||
<response xmlns:ab='http://www.example.com/ns2'> \
|
||||
<meta> \
|
||||
<component id='seite1' class='component'> \
|
||||
<properties xmlns:cd='http://www.example.com/ns3'> \
|
||||
<property name='prop1'> \
|
||||
<thing /> \
|
||||
<value>1</value> \
|
||||
</property> \
|
||||
<property name='prop2'> \
|
||||
<thing att='something' /> \
|
||||
</property> \
|
||||
<foo_bar>foo</foo_bar> \
|
||||
</properties> \
|
||||
</component> \
|
||||
</meta> \
|
||||
</response> \
|
||||
</jsconf> \
|
||||
</soap:Body> \
|
||||
</soap:Envelope>";
|
||||
|
||||
return jQuery.parseXML( string );
|
||||
};
|
||||
|
||||
this.createWithFriesXML = function() {
|
||||
var string = "<?xml version='1.0' encoding='UTF-8'?> \
|
||||
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' \
|
||||
@ -384,6 +410,18 @@ this.loadTests = function() {
|
||||
|
||||
// Get testSubproject from testrunner first
|
||||
require( [ parentUrl + "test/data/testrunner.js" ], function() {
|
||||
|
||||
// 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.
|
||||
QUnit.jQuerySelectorsPos = includesModule( "selector" );
|
||||
|
||||
// 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).
|
||||
QUnit.jQuerySelectors = includesModule( "selector" );
|
||||
|
||||
var i = 0,
|
||||
tests = [
|
||||
// A special module with basic tests, meant for
|
||||
|
@ -1270,7 +1270,7 @@ QUnit.test( "addClass(Array)", function( assert ) {
|
||||
} );
|
||||
|
||||
QUnit.test( "addClass(Function) with incoming value", function( assert ) {
|
||||
assert.expect( 52 );
|
||||
assert.expect( 59 );
|
||||
var pass, i,
|
||||
div = jQuery( "#qunit-fixture div" ),
|
||||
old = div.map( function() {
|
||||
@ -1278,10 +1278,8 @@ QUnit.test( "addClass(Function) with incoming value", function( assert ) {
|
||||
} );
|
||||
|
||||
div.addClass( function( i, val ) {
|
||||
if ( this.id !== "_firebugConsole" ) {
|
||||
assert.equal( val, old[ i ], "Make sure the incoming value is correct." );
|
||||
return "test";
|
||||
}
|
||||
} );
|
||||
|
||||
pass = true;
|
||||
@ -1347,17 +1345,15 @@ QUnit.test( "removeClass(Array) - simple", function( assert ) {
|
||||
} );
|
||||
|
||||
QUnit.test( "removeClass(Function) with incoming value", function( assert ) {
|
||||
assert.expect( 52 );
|
||||
assert.expect( 59 );
|
||||
|
||||
var $divs = jQuery( "#qunit-fixture div" ).addClass( "test" ), old = $divs.map( function() {
|
||||
return jQuery( this ).attr( "class" );
|
||||
} );
|
||||
|
||||
$divs.removeClass( function( i, val ) {
|
||||
if ( this.id !== "_firebugConsole" ) {
|
||||
assert.equal( val, old[ i ], "Make sure the incoming value is correct." );
|
||||
return "test";
|
||||
}
|
||||
} );
|
||||
|
||||
assert.ok( !$divs.is( ".test" ), "Remove Class" );
|
||||
|
@ -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" );
|
||||
@ -417,6 +417,16 @@ QUnit.test( "isXMLDoc - XML", function( assert ) {
|
||||
assert.ok( jQuery.isXMLDoc( jQuery( "desc", svg )[ 0 ] ), "XML desc Element" );
|
||||
} );
|
||||
|
||||
QUnit.test( "isXMLDoc - falsy", function( assert ) {
|
||||
assert.expect( 5 );
|
||||
|
||||
assert.strictEqual( jQuery.isXMLDoc( undefined ), false, "undefined" );
|
||||
assert.strictEqual( jQuery.isXMLDoc( null ), false, "null" );
|
||||
assert.strictEqual( jQuery.isXMLDoc( false ), false, "false" );
|
||||
assert.strictEqual( jQuery.isXMLDoc( 0 ), false, "0" );
|
||||
assert.strictEqual( jQuery.isXMLDoc( "" ), false, "\"\"" );
|
||||
} );
|
||||
|
||||
QUnit.test( "XSS via location.hash", function( assert ) {
|
||||
var done = assert.async();
|
||||
assert.expect( 1 );
|
||||
@ -475,7 +485,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 {
|
||||
|
@ -965,7 +965,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" );
|
||||
@ -998,7 +998,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></a><p>" ).find( "*" ).addBack(),
|
||||
hiddenDetached = jQuery( "<p><a></a></p>" ).find( "*" ).addBack().css( "display", "none" ),
|
||||
@ -1022,12 +1022,14 @@ QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "detached to
|
||||
"cascade-hidden element in detached tree" );
|
||||
} );
|
||||
|
||||
QUnit[ jQuery.find.compile && jQuery.fn.toggle &&
|
||||
QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle &&
|
||||
document.body.attachShadow && 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" } );
|
||||
@ -1450,7 +1452,7 @@ QUnit.test( "css opacity consistency across browsers (trac-12685)", function( as
|
||||
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( 17 );
|
||||
|
||||
var $div, $table, $a;
|
||||
@ -1486,7 +1488,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 (trac-4512)" );
|
||||
|
||||
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
16
test/unit/effects.js
vendored
@ -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" );
|
||||
} );
|
||||
@ -812,7 +812,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" );
|
||||
@ -1638,7 +1638,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 (trac-7157)", function( assert ) {
|
||||
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "Animation callback should not show animated element as :animated (trac-7157)", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
var foo = jQuery( "#foo" );
|
||||
@ -1651,7 +1651,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 (trac-14623)", function( assert ) {
|
||||
QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "Initial step callback should show element as :animated (trac-14623)", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
var foo = jQuery( "#foo" );
|
||||
@ -2167,7 +2167,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" );
|
||||
@ -2207,7 +2207,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" );
|
||||
@ -2246,7 +2246,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" );
|
||||
@ -2257,7 +2257,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" );
|
||||
|
@ -1840,7 +1840,7 @@ QUnit.test( "events with type matching an Object.prototype property, cloned elem
|
||||
} );
|
||||
|
||||
// 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" );
|
||||
|
||||
@ -1858,6 +1858,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "delegated event with delegateTa
|
||||
.find( "#a0_0" ).trigger( "click" ).end()
|
||||
.off( "click" );
|
||||
|
||||
if ( QUnit.jQuerySelectorsPos ) {
|
||||
// Positional selector (trac-11315)
|
||||
markup.find( "ul" ).eq( 0 )
|
||||
.on( "click", ">li>a", function() {
|
||||
@ -1870,6 +1871,10 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "delegated event with delegateTa
|
||||
.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();
|
||||
} );
|
||||
|
@ -193,7 +193,7 @@ function testAppendForObject( valueObj, isFragment, assert ) {
|
||||
|
||||
function testAppend( valueObj, assert ) {
|
||||
|
||||
assert.expect( 78 );
|
||||
assert.expect( 82 );
|
||||
|
||||
testAppendForObject( valueObj, false, assert );
|
||||
testAppendForObject( valueObj, true, assert );
|
||||
@ -1984,7 +1984,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" );
|
||||
@ -1992,8 +1992,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
|
||||
@ -2081,7 +2081,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" );
|
||||
@ -2089,8 +2089,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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -59,262 +59,377 @@ testIframe(
|
||||
userAgent = window.navigator.userAgent,
|
||||
expectedMap = {
|
||||
edge: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": false,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: false,
|
||||
scope: false,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ie_10_11: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": false,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": false,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": true,
|
||||
"noCloneChecked": false,
|
||||
"option": true,
|
||||
"optSelected": false,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": false,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": false,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: false,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: false,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: true,
|
||||
getById: true,
|
||||
noCloneChecked: false,
|
||||
option: true,
|
||||
optSelected: false,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: false,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: false,
|
||||
scope: false,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ie_9: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": false,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": false,
|
||||
"cors": false,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": true,
|
||||
"noCloneChecked": false,
|
||||
"option": false,
|
||||
"optSelected": false,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": false,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": false,
|
||||
"scrollboxSize": false
|
||||
ajax: true,
|
||||
boxSizingReliable: false,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: false,
|
||||
cssSupportsSelector: false,
|
||||
cors: false,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: false,
|
||||
focusin: true,
|
||||
getById: false,
|
||||
noCloneChecked: false,
|
||||
option: false,
|
||||
optSelected: false,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: false,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: false,
|
||||
scope: false,
|
||||
scrollboxSize: false,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
chrome: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
safari: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
safari_9_10: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": false,
|
||||
"pixelPosition": false,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: false,
|
||||
pixelPosition: false,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
firefox: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": false,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: true,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: false,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
firefox_102: {
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: false,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
firefox_60: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": false,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: false,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ios: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": true,
|
||||
"pixelPosition": true,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: true,
|
||||
pixelPosition: true,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ios_9_10: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": false,
|
||||
"pixelPosition": false,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: false,
|
||||
pixelPosition: false,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ios_8: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": false,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": false,
|
||||
"pixelPosition": false,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: false,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: false,
|
||||
pixelPosition: false,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
ios_7: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": true,
|
||||
"checkOn": true,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": false,
|
||||
"pixelPosition": false,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": true,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: true,
|
||||
checkOn: true,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: false,
|
||||
pixelPosition: false,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: true,
|
||||
reliableTrDimensions: true,
|
||||
scope: true,
|
||||
scrollboxSize: true,
|
||||
sortDetached: true,
|
||||
sortStable: true
|
||||
},
|
||||
android: {
|
||||
"ajax": true,
|
||||
"boxSizingReliable": true,
|
||||
"checkClone": false,
|
||||
"checkOn": false,
|
||||
"clearCloneStyle": true,
|
||||
"cors": true,
|
||||
"createHTMLDocument": true,
|
||||
"focusin": false,
|
||||
"noCloneChecked": true,
|
||||
"option": true,
|
||||
"optSelected": true,
|
||||
"pixelBoxStyles": false,
|
||||
"pixelPosition": false,
|
||||
"radioValue": true,
|
||||
"reliableMarginLeft": false,
|
||||
"reliableTrDimensions": true,
|
||||
"scrollboxSize": true
|
||||
ajax: true,
|
||||
boxSizingReliable: true,
|
||||
checkClone: false,
|
||||
checkOn: false,
|
||||
clearCloneStyle: true,
|
||||
cssSupportsSelector: false,
|
||||
cors: true,
|
||||
createHTMLDocument: true,
|
||||
disconnectedMatch: true,
|
||||
focusin: false,
|
||||
getById: true,
|
||||
noCloneChecked: true,
|
||||
option: true,
|
||||
optSelected: true,
|
||||
pixelBoxStyles: false,
|
||||
pixelPosition: false,
|
||||
radioValue: true,
|
||||
reliableMarginLeft: false,
|
||||
reliableTrDimensions: true,
|
||||
scope: false,
|
||||
scrollboxSize: true,
|
||||
sortDetached: false,
|
||||
sortStable: false
|
||||
}
|
||||
};
|
||||
|
||||
// Make the slim build pass tests.
|
||||
for ( browserKey in expectedMap ) {
|
||||
if ( !jQuery.ajax ) {
|
||||
if ( !includesModule( "ajax" ) ) {
|
||||
delete expectedMap[ browserKey ].ajax;
|
||||
delete expectedMap[ browserKey ].cors;
|
||||
}
|
||||
}
|
||||
|
||||
// Make the selector-native build pass tests.
|
||||
for ( browserKey in expectedMap ) {
|
||||
if ( !includesModule( "selector" ) ) {
|
||||
delete expectedMap[ browserKey ].cssSupportsSelector;
|
||||
delete expectedMap[ browserKey ].disconnectedMatch;
|
||||
delete expectedMap[ browserKey ].getById;
|
||||
delete expectedMap[ browserKey ].scope;
|
||||
delete expectedMap[ browserKey ].sortDetached;
|
||||
delete expectedMap[ browserKey ].sortStable;
|
||||
}
|
||||
}
|
||||
|
||||
if ( /edge\//i.test( userAgent ) ) {
|
||||
expected = expectedMap.edge;
|
||||
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
|
||||
@ -328,8 +443,10 @@ testIframe(
|
||||
expected = expectedMap.chrome;
|
||||
} else if ( /\b(?:9|10)\.\d+(\.\d+)* safari/i.test( userAgent ) ) {
|
||||
expected = expectedMap.safari_9_10;
|
||||
} else if ( /firefox\/(?:4\d|5\d|60)/i.test( userAgent ) ) {
|
||||
} else if ( /firefox\/[456]\d\b/i.test( userAgent ) ) {
|
||||
expected = expectedMap.firefox_60;
|
||||
} else if ( /firefox\/(?:[789]\d|102)\b/i.test( userAgent ) ) {
|
||||
expected = expectedMap.firefox_102;
|
||||
} else if ( /firefox/i.test( userAgent ) ) {
|
||||
expected = expectedMap.firefox;
|
||||
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
|
||||
@ -359,6 +476,15 @@ testIframe(
|
||||
j++;
|
||||
}
|
||||
|
||||
// Add an assertion per undefined support prop as it may
|
||||
// not even exist on computedSupport but we still want to run
|
||||
// the check.
|
||||
for ( prop in expected ) {
|
||||
if ( expected[ prop ] === undefined ) {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
assert.expect( j );
|
||||
|
||||
for ( i in expected ) {
|
||||
@ -387,6 +513,15 @@ testIframe(
|
||||
i++;
|
||||
}
|
||||
|
||||
// Add an assertion per undefined support prop as it may
|
||||
// not even exist on computedSupport but we still want to run
|
||||
// the check.
|
||||
for ( prop in expected ) {
|
||||
if ( expected[ prop ] === undefined ) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
assert.expect( i );
|
||||
|
||||
// Record all support props and the failing ones and ensure everyone
|
||||
@ -394,7 +529,7 @@ testIframe(
|
||||
for ( browserKey in expectedMap ) {
|
||||
for ( supportTestName in expectedMap[ browserKey ] ) {
|
||||
supportProps[ supportTestName ] = true;
|
||||
if ( expectedMap[ browserKey ][ supportTestName ] !== true ) {
|
||||
if ( !expectedMap[ browserKey ][ supportTestName ] ) {
|
||||
failingSupportProps[ supportTestName ] = true;
|
||||
}
|
||||
}
|
||||
|
@ -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" );
|
||||
@ -50,8 +50,24 @@ QUnit.test( "find(node|jQuery object)", function( assert ) {
|
||||
assert.equal( $two.find( $foo[ 0 ] ).addBack().length, 2, "find preserves the pushStack, see trac-12009" );
|
||||
} );
|
||||
|
||||
QUnit.test( "is(String|undefined)", function( assert ) {
|
||||
assert.expect( 23 );
|
||||
QUnit.test( "is(falsy|invalid)", function( assert ) {
|
||||
assert.expect( 5 );
|
||||
|
||||
assert.ok( !jQuery( "#foo" ).is( 0 ), "Expected false for an invalid expression - 0" );
|
||||
assert.ok( !jQuery( "#foo" ).is( null ), "Expected false for an invalid expression - null" );
|
||||
assert.ok( !jQuery( "#foo" ).is( "" ), "Expected false for an invalid expression - \"\"" );
|
||||
assert.ok( !jQuery( "#foo" ).is( undefined ), "Expected false for an invalid expression - undefined" );
|
||||
assert.ok( !jQuery( "#foo" ).is( { plain: "object" } ), "Check passing invalid object" );
|
||||
} );
|
||||
|
||||
QUnit.test( "is(String)", function( assert ) {
|
||||
assert.expect( 33 );
|
||||
|
||||
var link = document.getElementById( "simon1" ),
|
||||
input = document.getElementById( "text1" ),
|
||||
option = document.getElementById( "option1a" ),
|
||||
disconnected = document.createElement( "div" );
|
||||
|
||||
assert.ok( jQuery( "#form" ).is( "form" ), "Check for element: A form must be a form" );
|
||||
assert.ok( !jQuery( "#form" ).is( "div" ), "Check for element: A form is not a div" );
|
||||
assert.ok( jQuery( "#mark" ).is( ".blog" ), "Check for class: Expected class 'blog'" );
|
||||
@ -67,17 +83,56 @@ QUnit.test( "is(String|undefined)", function( assert ) {
|
||||
assert.ok( jQuery( "#radio2" ).is( ":checked" ), "Check for pseudoclass: Expected to be checked" );
|
||||
assert.ok( !jQuery( "#radio1" ).is( ":checked" ), "Check for pseudoclass: Expected not checked" );
|
||||
|
||||
assert.ok( !jQuery( "#foo" ).is( 0 ), "Expected false for an invalid expression - 0" );
|
||||
assert.ok( !jQuery( "#foo" ).is( null ), "Expected false for an invalid expression - null" );
|
||||
assert.ok( !jQuery( "#foo" ).is( "" ), "Expected false for an invalid expression - \"\"" );
|
||||
assert.ok( !jQuery( "#foo" ).is( undefined ), "Expected false for an invalid expression - undefined" );
|
||||
assert.ok( !jQuery( "#foo" ).is( { plain: "object" } ), "Check passing invalid object" );
|
||||
|
||||
// test is() with comma-separated expressions
|
||||
assert.ok( jQuery( "#en" ).is( "[lang=\"en\"],[lang=\"de\"]" ), "Comma-separated; Check for lang attribute: Expect en or de" );
|
||||
assert.ok( jQuery( "#en" ).is( "[lang=\"de\"],[lang=\"en\"]" ), "Comma-separated; Check for lang attribute: Expect en or de" );
|
||||
assert.ok( jQuery( "#en" ).is( "[lang=\"en\"] , [lang=\"de\"]" ), "Comma-separated; Check for lang attribute: Expect en or de" );
|
||||
assert.ok( jQuery( "#en" ).is( "[lang=\"de\"] , [lang=\"en\"]" ), "Comma-separated; Check for lang attribute: Expect en or de" );
|
||||
|
||||
link.title = "Don't click me";
|
||||
assert.ok( jQuery( link ).is( "[rel='bookmark']" ), "attribute-equals string (delimited via apostrophes)" );
|
||||
assert.ok( jQuery( link ).is( "[rel=bookmark]" ), "attribute-equals identifier" );
|
||||
assert.ok( jQuery( link ).is( "[\nrel = bookmark\t]" ),
|
||||
"attribute-equals identifier (whitespace ignored)" );
|
||||
assert.ok( jQuery( link ).is( "a[title=\"Don't click me\"]" ),
|
||||
"attribute-equals string containing single quote" );
|
||||
|
||||
// jQuery trac-12303
|
||||
input.setAttribute( "data-pos", ":first" );
|
||||
assert.ok( jQuery( input ).is( "input[data-pos=\\:first]" ),
|
||||
"attribute-equals POS in identifier" );
|
||||
assert.ok( jQuery( input ).is( "input[data-pos=':first']" ),
|
||||
"attribute-equals POS in string" );
|
||||
|
||||
if ( QUnit.jQuerySelectors ) {
|
||||
assert.ok( jQuery( input ).is( ":input[data-pos=':first']" ),
|
||||
"attribute-equals POS in string after pseudo" );
|
||||
} else {
|
||||
assert.ok( "skip", ":input not supported in selector-native" );
|
||||
}
|
||||
|
||||
option.setAttribute( "test", "" );
|
||||
assert.ok( jQuery( option ).is( "[id=option1a]" ),
|
||||
"id attribute-equals identifier" );
|
||||
|
||||
if ( QUnit.jQuerySelectors ) {
|
||||
assert.ok( jQuery( option ).is( "[id*=option1][type!=checkbox]" ),
|
||||
"attribute-not-equals identifier" );
|
||||
} else {
|
||||
assert.ok( "skip", "attribute-not-equals not supported in selector-native" );
|
||||
}
|
||||
|
||||
assert.ok( jQuery( option ).is( "[id*=option1]" ), "attribute-contains identifier" );
|
||||
assert.ok( !jQuery( option ).is( "[test^='']" ),
|
||||
"attribute-starts-with empty string (negative)" );
|
||||
|
||||
option.className = "=]";
|
||||
assert.ok( jQuery( option ).is( ".\\=\\]" ),
|
||||
"class selector with attribute-equals confusable" );
|
||||
|
||||
assert.ok( jQuery( disconnected ).is( "div" ), "disconnected element" );
|
||||
assert.ok( jQuery( link ).is( "* > *" ), "child combinator matches in document" );
|
||||
assert.ok( !jQuery( disconnected ).is( "* > *" ), "child combinator fails in fragment" );
|
||||
} );
|
||||
|
||||
QUnit.test( "is() against non-elements (trac-10178)", function( assert ) {
|
||||
@ -130,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" );
|
||||
@ -142,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
|
||||
@ -279,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 ) {
|
||||
@ -360,7 +415,7 @@ QUnit.test( "closest()", function( assert ) {
|
||||
assert.deepEqual( jq.contents().closest( "*" ).get(), jq.get(), "Text node input (trac-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(), [],
|
||||
@ -390,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')" );
|
||||
|
||||
@ -470,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(),
|
||||
@ -561,7 +616,11 @@ QUnit.test( "siblings([String])", function( assert ) {
|
||||
assert.expect( 6 );
|
||||
assert.deepEqual( jQuery( "#en" ).siblings().get(), q( "sndp", "sap" ), "Check for siblings" );
|
||||
assert.deepEqual( jQuery( "#nonnodes" ).contents().eq( 1 ).siblings().get(), q( "nonnodesElement" ), "Check for text node siblings" );
|
||||
assert.deepEqual( jQuery( "#foo" ).siblings( "form, b" ).get(), q( "form", "floatTest", "lengthtest", "name-tests", "testForm" ), "Check for multiple filters" );
|
||||
assert.deepEqual(
|
||||
jQuery( "#foo" ).siblings( "form, b" ).get(),
|
||||
q( "form", "floatTest", "lengthtest", "name-tests", "testForm", "disabled-tests" ),
|
||||
"Check for multiple filters"
|
||||
);
|
||||
|
||||
var set = q( "sndp", "en", "sap" );
|
||||
assert.deepEqual( jQuery( "#en, #sndp" ).siblings().get(), set, "Check for unique results from siblings" );
|
||||
@ -569,7 +628,7 @@ QUnit.test( "siblings([String])", function( assert ) {
|
||||
assert.equal( jQuery( "<a></a>" ).siblings().length, 0, "Detached elements have no siblings (trac-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)" );
|
||||
@ -581,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" );
|
||||
} );
|
||||
|
Loading…
Reference in New Issue
Block a user