Commit Graph

2673 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
d591bdd494
Widget: Don't let widget name affect $.ui prototype & constructor
This is an edge case and it only affects code accepting untrusted input as
a widget name, but it's still technically correct to filter these out.

Closes gh-2310
2024-10-30 09:58:01 +01:00
Michał Gołębiowski-Owczarek
85bed8ddd8
Build: Fix an XSS in the test server HTML serving logic
The test server has a rule for `/tests/unit/*/*.html` paths that serves
a proper local file. However, the parameters after `/unit/` so far accepted
many characters that have special meaning, leading to possibly reading a file
from outside of the Git repository. Fix that by only accepting alphanumeric
characters, `-` or `_`.

This should resolve one CodeQL alert.

Closes gh-2309
2024-10-28 16:47:29 +01:00
Michał Gołębiowski-Owczarek
af8adca548
Tabs: Use CSS.escape for sanitizing selectors
The previous private `_sanitizeSelector` API was not correctly escaping
backslashes and is now removed. The native API should always be correct.

Closes gh-2307
2024-10-27 00:04:00 +02:00
Michał Gołębiowski-Owczarek
ebdcd0d866
Tests: Fix titles of jquery-patch.js tests
The pages were erroneously titled after "Form Reset Mixin".

Closes gh-2308
2024-10-25 23:46:00 +02:00
Michał Gołębiowski-Owczarek
b8fff16dc4
Demos: Remove deprecated button APIs
Remove usage of deprecated button options:
* `icons`: https://jqueryui.com/upgrade-guide/1.12/#deprecated-icons-options-in-favor-of-icon-and-iconposition
* `text`: https://jqueryui.com/upgrade-guide/1.12/#deprecated-text-option-in-favor-of-showlabel

Fixes gh-2295
Closes gh-2296
2024-09-30 18:05:22 +02:00
Michał Gołębiowski-Owczarek
36ed9fc3b0
Effect: Remove demos & visual tests of the transfer effect
The transfer effect is deprecated and not present unless `$.uiBackCompat` is set
to `true`. In previous UI versions, the default was including the backwards
compat layer so these demos & tests worked; now they do not by default. Just
remove them.

Fixes gh-2278
Closes gh-2291
2024-09-16 17:16:40 +02:00
Daniel García
c934995efa
Resizable: Fix content shrink on resize
Make resizable elements not shrink on resize when they have scrollbars
and "box-sizing: content-box".

Fixes: gh-2277
Closes gh-2281
2024-09-09 23:51:57 +02:00
Ralf Koller
d564731f20
Dialog: Add option to put the dialog title in a header element
Implement a new option: `uiDialogTitleHeadingLevel`, allowing to change
the `span` wrapping the dialog title into a heading element (`h1`-`h6`).
Value `0` represents the `span`, values 1-6 - a heading at the specified
level.

Fixes gh-2271
Closes gh-2275
2024-09-09 17:55:58 +02:00
Michał Gołębiowski-Owczarek
fd1b8a03b2
Tests: Properly check $.uiBackCompat in common widget tests
The "common widget" tests, checking if a widget doesn't overwrite some
core widget APIs wasn't running as it was incorrectly checking for
`$.uiBackCompat === false` instead of `$.uiBackCompat !== true` after the
default changed in gh-2250.

Fixing the check uncovered that the draggable & sortable modules do
overwrite the `_trigger` method. Add an exception in the test for that;
at this stage of the project we don't plan to change the implementation.

Closes gh-2286
Ref gh-2250
2024-09-09 17:52:53 +02:00
Porter Clevidence
02a6e6bcb0
Datepicker: Hide the UI on destroy
When the datepicker UI is shown and then destroyed programmatically:
```js
$( "#datepicker" ).datepicker( "destroy" );
```
hide the datepicker UI without the need for an explicit user action.
Previously, in 1.12 the UI would not disappear immediately but only after the
first `mousedown`. In later 1.13 versions, the UI would not disappear at all.

Fixes gh-2178
Closes gh-2268
2024-08-05 19:30:53 +02:00
Michał Gołębiowski-Owczarek
cd41c45d91
Tests: Update jQuery Migrate from 3.4.1 to 3.5.2, simplify Migrate setup
Apart from updating jQuery Migrate, the setup is now changed so that exact
Migrate versions are only references when fetching npm packages; other than
that, they're represented as `jquery-migrate-1.x` & `jquery-migrate-3.x`. This
will allow smaller changes when updating jQuery Migrate in the future.

Closes gh-2273
2024-07-30 17:53:47 +02:00
Ralf Koller
376f142b9d
Dialog: Add aria-modal support
Reflect the `modal` dialog option into the `aria-modal` attribute -
when `modal` is `true`, set `aria-modal` to `"true"`.

This helps some accessibility tools like VoiceOver with their rotor
functionality as it reduces the number of elements presented.

Fixes gh-2246
Closes gh-2257

Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
2024-06-14 13:04:00 +02:00
Timmy Willison
1f251ca399
Tests: remove testswarm grunt task
Closes gh-2263
2024-06-11 18:05:06 +02:00
Timmy Willison
f47c7fe44d
Tests: remove code supporting jenkins and testswarm
Close gh-2251
2024-05-15 15:19:23 -04:00
Michał Gołębiowski-Owczarek
5f615c275d
Tests: Fix form-reset-mixin test module name, add to the tests HTML
Ref gh-2249
2024-05-15 00:38:40 +02:00
Michał Gołębiowski-Owczarek
03cde342cd
All: Remove the deprecated ui/core.js file
Also, fix checkboxradio visual tests.

Ref gh-2249
2024-05-15 00:38:40 +02:00
Michał Gołębiowski-Owczarek
9887579b61
All: Stop relying on jquery-patch.js internally, add tests
Avoid relying on jQuery patches. Instead:
* use `CSS.escape` instead of `jQuery.escapeSelector`
* use `.filter()` with a proper handler instead of `.even()`

Keep `jquery-patch.js` for backwards compatibility, though.

Also, add tests for jquery-patch.

Ref gh-2249
2024-05-15 00:38:40 +02:00
Michał Gołębiowski-Owczarek
bb49bd794b
All: Drop support for IE & some other browsers (but mostly IE)
Closes gh-2249
2024-05-15 00:38:40 +02:00
Michał Gołębiowski-Owczarek
daa6fb55b3
All: Drop support for jQueries different than the latest for each major
Also, remove the ability to run the test suite in jQuery <1.12.4 & <2.2.4.

Closes gh-2249
2024-05-15 00:38:30 +02:00
Michał Gołębiowski-Owczarek
ac8b1e4eee
Core: Make back compat disabled by default
Closes gh-2250
2024-05-13 18:11:57 +02:00
Michał Gołębiowski-Owczarek
8e34aa6155
Docs: Update leftover HTTP Trac URLs to HTTPS 2024-04-26 17:28:11 +02:00
Michał Gołębiowski-Owczarek
4966aea381
Docs: Change a few most common domains from HTTP to HTTPS
Also, update a few stale URLs to what they redirect now to.

Closes gh-2244
2024-04-26 16:25:34 +02:00
Michał Gołębiowski-Owczarek
1374020009
Tests: Skip a problematic keyboard test in IE with jQuery 3.6
jQuery 3.6 has issues with focus handling in IE which breaks this test.
The issues were fixed in jQuery 3.7, so we just accept them here.

Closes gh-2231
2024-04-12 15:23:31 +02:00
Michał Gołębiowski-Owczarek
e7a0da63ea
Tests: Increase robustness of a draggable revert test
One of the changes is increasing `revertDuration` from 200 to 300. For some
reason, when jQuery 3.1 is used in an iframe (which TestSwarm uses) the timings
are lower than expected and `setTimeout` too slow and the check for animation
happens too late.

Closes gh-2230
2024-04-12 15:23:05 +02:00
Michał Gołębiowski-Owczarek
ab2a2a973e
Tests: Workaround a jQuery 1.8 issue with one dialog test
The test "#8958: dialog can be opened while opening" had special behavior in
jQuery 1.8 and the patch from commit 7adb13ac7c
broke those assumptions. Adjust the test so that it passes again.

Closes gh-2229
2024-04-12 15:22:05 +02:00
Timmy Willison
4af5caed7a
Tests: align test runner with other repos
Close gh-2234
2024-04-09 13:31:27 -04:00
Timmy Willison
91df20be6b
Tests: replace grunt-contrib-qunit with jQuery test runner
- add filestash workflow

Close gh-2221
2024-03-29 09:13:46 -04:00
Michał Gołębiowski-Owczarek
802642c373
Tests: Fix tests with the Git Core build
jQuery PR jquery/jquery#5452 removed special handling of boolean attributes.
Thankfully, this only broke a single jQuery UI test.

Closes gh-2220
2024-03-26 16:17:00 +01:00
Michał Gołębiowski-Owczarek
1be4538817
Build: Add jQuery 3.7.0 2023-05-12 00:48:38 +02:00
Michał Gołębiowski-Owczarek
ba249efb6b
Tests: Workaround IE issues in qunit-assert-domequal
In IE, `option` elements may have different initial `option` colors.
They may initially all be transparent, but later the selected
option gets a blue background with white text; we now ignore it.

The logic of `qunit-assert-domequal` was also fixed to use the same
method of fetching styles in all browsers; IE used to get a legacy
one meant for IE <9 due to a mistake in the performed check.
2023-05-10 17:34:14 +02:00
Michał Gołębiowski-Owczarek
613b522e9a
Tests: Make resizable tests a bit more forgiving 2023-05-10 17:34:14 +02:00
Michał Gołębiowski-Owczarek
b715135d11
Tests: Workaround a dialog test issue by a proper cleanup
The `#favorite-animal` focus & blur handlers used to not be cleaned up after
the test automatically, leading to issues with some jQuery versions.
2023-05-10 17:34:14 +02:00
Michał Gołębiowski-Owczarek
23655f0dbd
Tests: Fix selectmenu width tests in Firefox with jQuery 3.0 & 3.1
jQuery 3.0 & 3.1 used `getBoundingClientRect()` in its `width`/`height`
calculations and that causes minor differences in fractional width computations.
Allow a tiny delta in tests to fix those tests breaking in Firefox.

Ref jquery/jquery#3561
Closes gh-2159
2023-05-10 10:56:02 +02:00
Michał Gołębiowski-Owczarek
020828e7ff
Selectmenu: Fix selecting options following hidden ones
Change a2b25ef6ca made options with
the `hidden` attribute skipped when rendering. However, that makes
indexes misaligned with native options as hidden ones maintain their
index values. Instead, don't skip hidden options but add the `hidden`
attribute to the respective jQuery UI elements as well.

Fixes gh-2082
Closes gh-2144
Ref a2b25ef6ca
2023-05-10 10:55:01 +02:00
Michał Gołębiowski-Owczarek
beeb410ccb
Build: Add jQuery 3.6.4, update Migrate to 3.4.1
Closes gh-2161
2023-05-10 10:54:31 +02:00
Michał Gołębiowski-Owczarek
546214e869 Build: Fork vendors to remove QUnit deprecated API usage
Changes:
* add `tests/lib/vendor/**/*` to `.eslintignore`
* move `qunit-composite` to `tests/lib` so that we can modify it
* move `qunit-assert-classes` to `tests/lib` so that we can modify it
* move `qunit-assert-close` to `tests/lib` so that we can modify it
* replace `assert.push` with `assert.pushResult`
* remove usage of `QUnit.extend`

Closes gh-2157
2023-05-10 10:53:57 +02:00
Michał Gołębiowski-Owczarek
360259e2b2 Tests: Make Puppeter really fire Chrome on macOS
Also, workaround issues with QUnit Chrome bridge: the Chrome bridge
from `grunt-contrib-qunit` is now getting injected into every single
iframe, including an empty one that has no intention of running QUnit
tests. Since that bridge requires QUnit, it fails with an error
in such cases. Workaround the issue by wrapping the bridge in
another function that bails early if QUnit is not defined.

Ref gh-2157
2023-05-10 10:53:57 +02:00
Michał Gołębiowski-Owczarek
f36fe9e50d Tests: Switch from QUnit.jsDump to QUnit.dump
`QUnit.jsDump` was renamed to `QUnit.dump` in QUnit 2.0.

Ref gh-2157
2023-05-10 10:53:57 +02:00
Michał Gołębiowski-Owczarek
9dc2bf9737 Tests: Fix tooltip tests by destroying tooltips
Some tests were not properly destroying tooltips which made tests
start to fail with the new QUnit.

Ref gh-2157
2023-05-10 10:53:57 +02:00
Michał Gołębiowski-Owczarek
0977ea1b48 Demos:Tests: Avoid self-closing HTML tags
Self-closing tags are reported by newer versions of the htmllint
Grunt plugin. They also don't make sense in our HTML files
since they are not XHTML-compliant and they run in HTML mode
anyway.

Ref gh-2157
2023-05-10 10:53:57 +02:00
Kenneth DeBacker
f8990e68e2
Tests: Test only valid values for Datepicker defaultDate, min/maxDate
The docs say that valid periods when using string value and
period pairs as relative dates are "y", "m", "w", and "d"
https://api.jqueryui.com/datepicker/

Closes gh-2143
2023-03-30 13:05:41 +02:00
Michał Gołębiowski-Owczarek
3286792ec5
Build: Add jQuery 3.6.1-3.6.3, update Migrate to 3.4.0 2023-01-15 21:41:18 +01:00
Matías Cánepa
62f2ccc567
Resizable: Fix resizing of elems with box-sizing: border-box
Fixes gh-1979
Closes gh-2012
2022-10-10 11:00:50 +02:00
Michał Gołębiowski-Owczarek
8cc5bae1ca
Checkboxradio: Don't re-evaluate text labels as HTML
If you generate a Checkboxradio from a checkbox/radio with a label that
contains encoded HTML, e.g. `&lt;em&gt;test&lt;/em&gt;` this will work fine
at first. If, however a refresh is triggered on that instance (explicitly or
e.g. by turning it into a `Controlgroup`), the previously escaped HTML will
now be evaluated.

If the label was created based on some user input, this could lead to
unexpected code execution even though the initial output was escaped.

Fixes gh-2101
Closes gh-2102
2022-07-14 20:52:02 +02:00
Michał Gołębiowski-Owczarek
b53e7beb68 All: Remove deprecated .click() usage in demos/tests 2022-07-14 20:34:29 +02:00
Michał Gołębiowski-Owczarek
0c5becce0e
Widget: Optimize attachment of the _untrackClassesElement listener
jQuery UI 1.13.0 changed the logic attaching the `_untrackClassesElement`
listener in the `_classes` widget method; one of the side effects was calling
`this._on` for each node that needed the listener. That caused a severe
performance degradation for large comboboxes as each `_on` jQuery UI call
causes a jQuery `add` call that calls Sizzle's `uniqueSort` underneath.

Instead, collect the nodes that need the listener and then, outside of the loop,
create a jQuery object out of them and attach the listener once. That's still
slower than the jQuery 1.12 version but only slightly: 936 ms to 1.03s on a very
large list on a recent MacBook Pro, compared to ~30 seconds before this patch.

Fixes gh-2014
Closes gh-2037
2022-01-15 01:26:23 +01:00
Ben Mullins
933ce5d779
Autocomplete: Rewrite with a delay instead of appending the live region
This fixes the issue caused by https://bugs.jqueryui.com/ticket/9357.
We now empty the live region instead of appending to it, and we do so
after a brief timeout so the live region isn't updated on every mousemove
event or when quickly traversing through options.

Fixes gh-2002
Closes gh-2031
2022-01-05 11:35:34 +01:00
Michał Gołębiowski-Owczarek
ed637b04d7
Widget: Make contextless widget construction work
Due to the fact the widget factory code is now in strict mode, the check for
being called without using the `new` keyword started breaking if you save the
widget constructor to a variable before calling it:
```js
var customWidget = $.custom.customWidget;
customWidget( {}, elem );
```
as then `this` is undefined and checking for `this._createWidget` crashes.
Account for that with an additional check.

Fixes gh-2015
Closes gh-2019
2021-11-19 00:47:56 +01:00
Michał Gołębiowski-Owczarek
b52ee4012d
Sortable: Fix positioning when moving a Draggable item into a Sortable
PR gh-1793 removed setting `this.offset.parent` in the Draggable
`refreshPositions` method which broke position calculations when moving
a Draggable item into a connected Sortable. restore that assignment.

Ref gh-1793
Fixes gh-2001
Closes gh-2009
2021-11-15 18:39:25 +01:00
Michał Gołębiowski-Owczarek
efe3b22517
Sortable: Allow 0-height containers to be sortable as in 1.12.1
Note that container specific events will not fire when the dragged element
is interacting with zero height containers.

Fixes gh-1998
Closes gh-2008

Co-authored-by: A. Wells <borgboyone@users.noreply.github.com>
2021-11-08 18:21:03 +01:00