Commit Graph

228 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
fae5fee8b4
Tests: Exclude tests based on compilation flags, not API presence
Introduces a new test API, `includesModule`. The method returns whether
a particular module like "ajax" or "deprecated" is included in the current
jQuery build; it handles the slim build as well. The util was created so that
we don't treat presence of particular APIs to decide whether to run a test as
then if we accidentally remove an API, the tests would still not fail.

Fixes gh-5069
Closes gh-5046
2022-06-28 12:39:01 +02:00
Michał Gołębiowski-Owczarek
a338b407f2
CSS: Skip falsy values in addClass( array ), compress code
This change makes jQuery skip falsy values in `addClass( array )`
& `removeClass( array )` instead of stopping iteration when the first falsy
value is detected. This makes code like:
```js
elem.addClass( [ "a", "", "b" ] );
```
add both the `a` & `b` classes.

The code was also optimized for size a bit so it doesn't increase the
minified gzipped size.

Fixes gh-4998
Closes gh-5003
2022-01-24 18:56:49 +01:00
Michał Gołębiowski-Owczarek
5d5ea01511
Docs: Replace #NUMBER Trac issue references with trac-NUMBER
The GitHub UI treats `#NUMBER` as referring to its own issues which is confusing
when in jQuery source it's usually referring to the old deprecated Trac instance
at https://bugs.jquery.com. This change replaces all such Trac references with
`trac-NUMBER`.

A few of the references came with the Sizzle integration and referred to the
Sizzle GitHub bug tracker. Those have been replaced with full links instead.

A new entry describing issue reference conventions has been added to README.

Closes gh-4993
2022-01-04 16:27:18 +01:00
Michał Gołębiowski-Owczarek
4250b62878
Attributes: Don't stringify attributes in the setter
Stringifying attributes in the setter was needed for IE <=9 but it breaks
trusted types enforcement when setting a script `src` attribute.

Note that this doesn't mean script execution works. Since jQuery disables all
scripts by changing their type and then executes them by creating fresh script
tags with proper `src` & possibly other attributes, this unwraps any trusted
`src` wrappers, making the script not execute under strict CSP settings.
We might try to fix it in the future in a separate change.

Fixes gh-4948
Closes gh-4949
2021-11-01 18:10:23 +01:00
Michał Gołębiowski-Owczarek
a4421101fd
Attributes: Drop the toggleClass(boolean|undefined) signature
The behavior of this signature is not intuitive, especially if classes are
manipulated via other ways between `toggleClass` calls.

Fixes gh-3388
Closes gh-4766
2020-09-01 10:42:03 +02:00
Michał Gołębiowski-Owczarek
90fed4b453
Manipulation: Make jQuery.htmlPrefilter an identity function
Closes gh-4642
2020-03-16 21:49:29 +01:00
Michał Gołębiowski-Owczarek
ff2819911d
Attributes: Refactor val(): don't strip carriage return, isolate IE workarounds
Before this change, `val()` was stripping out carriage return characters from
the returned value. No test has relied on that. The logic was different for
option elements as its custom defined hook was omitting this stripping logic.

This commit gets rid of the carriage return removal and isolates the IE-only
select val getter to be skipped in other browsers.

Closes gh-4585
2020-01-13 19:25:01 +01:00
Michał Gołębiowski-Owczarek
eb35be528f
Tests: Remove obsolete jQuery data tests
The tests relied on `jQuery.cache` so they only ever worked in jQuery 1.x.

Closes gh-4586
2020-01-13 19:23:01 +01:00
Michał Gołębiowski-Owczarek
05184cc448
Selector: Make empty attribute selectors work in IE again
qSA in IE 11/Edge often (but not always) don't find elements with an empty
name attribute selector (`[name=""]`). Detect that & fall back to Sizzle
traversal.

Interestingly, IE 10 & older don't seem to have the issue.

Fixes gh-4435
Closes gh-4510
2019-11-18 22:10:55 +01:00
Michał Gołębiowski-Owczarek
47835965bd Selector: Inline Sizzle into the selector module
This commit removes Sizzle from jQuery, inlining its code & removing obsolete
workarounds where applicable.

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

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

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

Closes gh-4395
2019-07-29 21:19:21 +02:00
Michał Gołębiowski-Owczarek
79b74e043a
Selector: Port Sizzle tests to jQuery
Apart from porting most Sizzle tests to jQuery (mostly to its selector module),
this commit fixes selector-native so that a jQuery custom compilation that
excludes Sizzle passes all tests as well.

Closes gh-4406
2019-06-26 21:39:10 +02:00
Michał Gołębiowski-Owczarek
3527a38405
Core: Remove IE-specific support tests, rely on document.documentMode
Also, update some tests to IE-sniff when deciding whether
to skip a test.

Fixes gh-4386
Closes gh-4387
2019-05-13 21:39:56 +02:00
abnud1
c349818742 Build: Update test code for compatibility with QUnit 2.x (#4297)
Also, run `grunt npmcopy` to sync the "external" directory with dependencies
from package.json. For example, the Sinon library version didn't match.

Ref gh-4234
Closes gh-4297
2019-02-18 19:03:26 +01:00
Timmy Willison
91fb18190e
Tests: fix weird flaky attributes test in Edge 16
Fixes gh-3867
Close gh-3931
2018-01-16 10:18:27 -05:00
Timmy Willison
80f57f8a13
Attributes: allow array param in add/remove/toggleClass
+30 bytes instead of +182

Thanks to @faisaliyk for the first pass on this feature.

Fixes gh-3532
Close gh-3917
2018-01-08 11:43:53 -05:00
Timo Tijhof
ecd8ddea33
Tests: Add support for running unit tests via grunt with karma
- Update QUnit to 1.23.1
- Remove unused dl#dl from test/index.html
- Remove unused map#imgmap from test/index.html
- Ensure all urls to data use baseURI
- Add the 'grunt karma:main' task
  - customContextFile & customDebugFile
- Add 'npm run jenkins' script

Close gh-3744
Fixes gh-1999
2017-12-18 12:27:38 -05:00
Timmy Willison
3bbcce68d7
Core: rnotwhite -> rhtmlnotwhite and jQuery.trim -> stripAndCollapse
- Renames and changes rnotwhite to focus on HTML whitespace chars
- Change internal use of jQuery.trim to more accurate strip and collapse
- Adds tests to ensure HTML space characters are retained where valid
- Doesn't add tests where the difference is inconsequential and
  existing tests are adequate.

Fixes gh-3003
Fixes gh-3072
Close gh-3316
2016-09-15 10:40:27 -04:00
Oleg Gaidarenko
58c6ca9822 Build: ESLint details
Use eslint pragmas, fix new errors, etc

Closes gh-3148
2016-06-11 10:41:33 +03:00
Michał Gołębiowski
e06fda69f0 Attributes: Avoid infinite recursion on non-lowercase attribute getters
Attribute hooks are determined for the lowercase versions of attribute names
but this has not been reflected in the bool attribute hooks. The code that
temporarily removed a handler to avoid an infinite loop was removing an
incorrect handler causing stack overflow.

Fixes gh-3133
Refs gh-2914
Refs gh-2916
Closes gh-3134
2016-06-03 22:48:43 +02:00
Michał Gołębiowski
f9ea869ab5 Tests: Remove side-effects of one attributes test
One test in the attribute module was overwriting jQuery.expr.attrHandle.checked
and wasn't restoring the original state after it finished. It started causing
issues for another checked-related test.
2016-06-03 11:51:33 +02:00
Timmy Willison
7052698191 Attributes: strip/collapse whitespace for set values on selects
Fixes gh-2978
Close gh-3002
2016-03-17 12:24:51 -04:00
Alexander Lisianoi
ddb2c06f51 Tests: limit selection to #qunit-fixture in attributes.js
Ref gh-2880
Close gh-2921
2016-02-22 11:56:04 -05:00
William Robinet
12038c7234 Tests: fix typos
Closes gh-2927
2016-02-17 14:13:45 -05:00
Timmy Willison
780cac802b Attributes: fix setting selected on an option in IE<=11
Fixes gh-2732
Close gh-2840
2016-01-19 11:36:47 -05:00
Timmy Willison
a4d16a26ab Revert "Attributes: Remove undocumented .toggleClass( boolean ) signature"
This reverts commit 53f798cf4d.

- Turns out this is documented, even if not fully. Need to deprecate before removal.
2016-01-07 14:06:41 -05:00
Timmy Willison
fbf829b724 Attributes: exclusively lowercase A-Z in attribute names
Fixes gh-2730
Close gh-2749
2015-12-02 10:39:02 -05:00
Timmy Willison
79fc806e85 Attributes: return empty array for select-multiple with no values
Fixes gh-2562
Close gh-2689
2015-11-05 17:41:49 -05:00
Timmy Willison
87bd130289 Attributes: remove flakey test for selected attribute
- The change is already covered by the "checked" test.
  Since this test is redundant, just drop it.
2015-10-26 11:38:04 -04:00
Richard Gibson
f931786018 Tests: Post-Summit cleanup
Ref 67d7a2eefe
Ref c752a5030b
2015-10-25 15:25:56 -04:00
Timmy Willison
47ccf3daad Attributes: do not set properties to false when removing booleans
Fixes gh-1759
2015-10-21 16:23:44 -04:00
Joelle Fleurantin
c752a5030b Attributes: fix tabIndex on <img> in IE11
Fixes gh-2647
Closes gh-2664
2015-10-18 16:36:52 -04:00
Dave Methvin
4bf1a09522 Attributes: Use simpler boolean check vs a function call
Ref gh-2491
2015-10-18 12:39:38 -04:00
Dave Methvin
53f798cf4d Attributes: Remove undocumented .toggleClass( boolean ) signature
Fixes gh-2491
Close gh-2618
2015-10-18 12:38:59 -04:00
Oleg Gaidarenko
c8d15a2f9f Tests: further improvements QUnit 2.0 migration
* Remove QUnit jshint globals
* Extend QUnit.assert methods
* Use assert.async instead of start/stop/done

Ref b930d14ce6
2015-09-08 04:06:20 +03:00
Oleg Gaidarenko
10fdad742a Build: Update jscs and lint files
Fixes gh-2056
2015-09-07 20:03:50 +03:00
Oleg Gaidarenko
b930d14ce6 Tests: partially use new qunit interface
http://qunitjs.com/upgrade-guide-2.x/

For most of the boring work was used
https://github.com/apsdehal/qunit-migrate package

However, it can't update local qunit helpers, plus in some places
old QUnit.asyncTest signature is still used

Fixes gh-2540
2015-08-16 09:02:01 +03:00
Oleg Gaidarenko
aabe94edb4 Tests: don't use deprecated argument in test declaration
Closes gh-2507
2015-07-30 20:46:31 +03:00
Timmy Willison
20aaed367f Attributes: add SVG class manipulation
- Note: support for SVG is limited in jQuery,
  but this is one area where the cost vs benefit ratio
  was acceptable.

Fixes gh-2199
Close gh-2268
2015-05-12 10:13:46 -04:00
Timmy Willison
2905961bf7 Attributes: revert returning null for non-existant attributes
Ref https://github.com/jquery/jquery/issues/2118
2015-03-30 15:32:54 -04:00
Timmy Willison
7632b7454b Attributes: revert returning null for non-elements 2015-03-16 14:11:38 -04:00
Timmy Willison
5dc4616ca0 Attributes: fix failing test for new return value 2015-03-16 11:52:05 -04:00
Winston Howes
aaeed53e9f Attributes: return null when attribute does not exist
Fixes gh-2118
Close gh-2129
2015-03-16 11:21:24 -04:00
Michał Gołębiowski
f6302b0b53 Attributes: Use the option val hook in select val hook and simplify it
The hook is still defined; not using it could cause issues in IE<11.
Also, IE10 no longer throws when value not set but it still doesn't trim the
value. IE11 has all those issues fixed; support comments are updated.

Fixes gh-1902
Closes gh-1901
2014-12-08 22:39:58 +01:00
Richard Gibson
26276a307c Tests: Minor updates for QUnit 1.16 compatibility
More to come later.

(cherry picked from commit f6f8848fbe)
2014-12-05 12:34:17 -05:00
Oleg Gaidarenko
ebbbe965b8 Tests: Correct logic of a broken assertion 2014-04-15 17:45:59 +04:00
John Hoven
541e7349b6 Attributes: Trim whitespace from option text when returned as a value
Fixes #14858
Ref #14686
Closes gh-1531
(cherry picked from commit 9ec429cf62)

Conflicts:
	src/attributes/val.js
2014-03-20 15:47:35 -04:00
Oleg
a2250b0f4c Tests: Fix code style issues 2014-01-16 07:04:14 +04:00
Oleg
659ac9c155 Tests: Add assertion for the jQuery#val method 2014-01-16 06:58:54 +04:00
Oleg
fdd78fad19 Attrs: Remove outdated valHook for option element
This hook was relevant for BlackBerry 4.7 which is no longer supported.

But this code path now raises error in IE10-11 (#14686) in 1.x-master branch.
So to just to be safe, also add test for IE issue to this branch too.
2014-01-16 04:47:44 +04:00
cjqed
537e9ced61 Tests: Avoid use of QUnit.reset() in tests by splitting them
Fix #14040
Close gh-1457
2013-12-23 17:21:22 -05:00