Commit Graph

3948 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
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
49bb397606
Build: Fix the ESLint config for demos
Some checks failed
Filestash / Update Filestash (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (chrome, map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (chrome, map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (firefox, map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (firefox, map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / edge | ${{ matrix.JQUERYS.name }} (map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / edge | ${{ matrix.JQUERYS.name }} (map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / safari | ${{ matrix.JQUERYS.name }} (map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / safari | ${{ matrix.JQUERYS.name }} (map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
The ESLint config for `demos` extends the one for the `ui` directory. However,
the `ui` one used to not be a root one, making the `demos` one effectively not
depend on the `jquery` preset. Fix that and fix lots of lint violations in
`demos/search.js`.

Closes gh-2303
2024-10-17 23:47:29 +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
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
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
Michał Gołębiowski-Owczarek
68fda5beb2
Effect: Update jQuery Color from 2.2.0 to 3.0.0
Breaking changes applicable to jQuery UI:
* Use a space when serializing, remove the transparent case ([#88](https://github.com/jquery/jquery-color/issues/88), [aaf03cc](aaf03ccec3))

See https://github.com/jquery/jquery-color/releases/tag/3.0.0 for more
information.

Fixes gh-2240
2024-05-15 18:13:35 +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
f90eab84b5
Sortable: Rename storedStylesheet to _storedStylesheet
This follows the naming strategy for other internal properties.

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
7adb13ac7c
Dialog: Fix IE tests about interactions with other dialogs
The workaround triggering a second delayed focus to a tabbable element was
applied in jQueries 3.4 & 3.5 to fix IE issues. It also needs to be applied
in jQuery 3.6 which this commit adds.

This will no longer be needed in jQuery 3.7 and jQuery 3.x-git tests are
already passing because of that.

Closes gh-2160
2023-05-10 10:55:40 +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
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
5fa0db48d7
Core: Fix dependencies in ui/core.js
The `jquery-patch` reference was included with the `.js` extension which is
not allowed in AMD.

Fixes gh-2107
Closes gh-2109
2022-08-18 13:28:26 +02:00
Michał Gołębiowski-Owczarek
0df6e65830
All: Update JS Foundation mentions to OpenJS Foundation
Closes gh-2104
2022-07-19 09:36:55 +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
Denny Septian Panggabean
9d1fc97b4e
Datepicker: Capitalize some Indonesian words
Closes gh-2067
2022-07-14 19:53:59 +02:00
James Hinderks
1f467baaac
Selectmenu: Remove a call to the deprecated .focus() method
Replaces a call to the deprecated jQuery `.focus()` method
with `.trigger("focus")`.

Closes gh-2053
2022-07-14 19:43:16 +02:00
Felix Nagel
395aa7d056 Datepicker: Add missing localization for prevText and nextText
Fixes gh-2048
Closes gh-2050
Closes gh-2100
2022-07-14 18:47:30 +02:00
Felix Nagel
218c6af95a Datepicker: Remove symbols in localization
Follow-up to dfff5e7e999453f5d080c184bd4e3fdbfc93b83e

Fixes gh-2048
Closes gh-2050
2022-07-14 18:47:30 +02:00
Adam Lidén Hällgren
3126e12869 Datepicker: Remove symbols in localization
Fixes gh-2048
Closes gh-2050
Ref gh-2067
2022-07-14 18:47:30 +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
Josep Sanz
85fba3f107
Tooltip: Don't crash on empty content
Commit 1f2011ece removed a `try-catch` around triggering the `remove` handlers
in the `jQuery.cleanData` override. The `try-catch` was meant for old IE but it was
also catching an error coming from the tooltip `remove` handler depending on
being able to find a relevant tooltip. The `_find` method returns `null`, though,
when the tooltip cotent is empty.

Instead of restoring the `try-catch`, handle the `null` case in the `remove` handler.

Fixes gh-1990
Closes gh-1994

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
2021-11-08 11:53:45 +01:00
Michał Gołębiowski-Owczarek
2fd224d5cc
Effect: Define the jQuery variable before jQuery Color gets imported
We need to create a local jQuery because jQuery Color relies on it and the
global may not exist with AMD and a custom build (trac-10199). This worked
in UI 1.12 but stopped in 1.13 as jQuery Color is now sourced as an AMD module
and the variable started being defined after jQuery Color code. To restore the
proper order, move the variable declaration to a separate small module loaded
before jQuery Color.

Closes gh-1973
2021-09-03 14:42:30 +02:00
Michał Gołębiowski-Owczarek
440f38940d
Docs: Update removal comments to mention 1.14, not 1.13
We're not removing any deprecated API or legacy browser support in 1.13,
re-target comments to mention 1.14.

It's not guaranteed 1.14 will ever get released but if it will, it sounds like
a good moment to do those removals.

Closes gh-1970
2021-08-26 13:36:06 +02:00
c-lambert
cf938e2863
Datepicker: Get selectedDay from data-date instead of element contents
This makes datepicker work fine even if translation software modifies texts on the page.

Closes gh-1943
2021-07-12 09:41:41 +02:00
Michał Gołębiowski-Owczarek
70dae67b73
Build: Migrate from JSHint & JSCS to ESLint
Fixes #15393
Closes gh-1958
2021-06-07 00:58:12 +02:00
Patrick McKay
17d115b829 Datepicker: Add option for onUpdateDatepicker callback
Add a new option named onUpdateDatepicker that allows a custom callback
to be provided. If provided, the callback is called at the end of
$.datepicker._updateDatepicker.
2021-05-21 17:58:10 +02:00
Mikolaj Wolicki
b864cd103a Fix: Adapt datpicker.js for a11y 2021-05-15 18:29:08 +02:00
Michał Gołębiowski-Owczarek
7c6a9f0128
All: Drop $.ui.escapeSelector in favor of $.escapeSelector
Fixes #14991
Closes gh-1957
2021-05-14 23:37:19 +02:00
Michał Gołębiowski-Owczarek
afe20b79a6
Datepicker: Make sure text option are text, shorten HTML strings
Instead of using enormous HTML strings, various elements are now constructed
using jQuery APIs. This makes it more obvious user-provided data is used
correctly.

Fixes #15284
Closes gh-1953
2021-05-12 00:59:42 +02:00
Michał Gołębiowski-Owczarek
effa323f15
Position: Make sure of is treated as a CSS selector
Closes gh-1955
2021-05-04 13:31:39 +02:00
Michał Gołębiowski-Owczarek
32850869d3
Datepicker: Make sure altField is treated as a CSS selector
Closes gh-1954
2021-05-04 13:30:06 +02:00
Michał Gołębiowski-Owczarek
834ee5f7cf
Dialog: Workaround broken focus re-triggering in jQuery 3.4/3.5
Focus re-triggering in jQuery 3.4/3.5 makes the original element
have its focus event propagated last, breaking the re-targeting.
Trigger focus in a delay in addition if needed to avoid the issue.

This fixes the "interaction between overlay and other dialogs" core dialog
test when tested against jQuery 3.4/3.5.

Closes gh-1946
Ref jquery/jquery#4382
2021-02-22 00:02:02 +01:00
Paul Capron
f5d38e2e05
Focusable: Fix handling of visibility: collapse
"collapse" is similar to "hidden", with a slight difference in the case
of tr/tbody/td/colgroup elements.
See https://www.w3.org/TR/CSS22/visufx.html#visibility
See https://www.w3.org/TR/CSS22/tables.html#dynamic-effects
See https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#Table_example

"visibility: collapse" elements are always not focusable, though.

Commit d3025968f3 introduced a regression by testing with `!== "hidden"`
instead of `=== "visible"`.

Closes gh-1843
2020-10-14 23:53:11 +02:00
Hrvoje Novosel
2434dfd45d Widget: Fix boolean option when under use strict
Fix for `options === true` when using jQuery UI under `use strict`,
which throws:
```
Uncaught TypeError: Cannot create property 'complete' on boolean 'true'
```
on line:
```js
options.complete = callback;
```

Closes gh-1931
2020-10-06 14:54:13 +02:00
Jérémy Munsch
dadde722a4 Resizable: Fix CSP violation (style unsafe-inline) 2020-08-11 23:43:45 +02:00
Michał Gołębiowski-Owczarek
74b5d8d7b9
All: Remove a leftover empty file
Closes gh-1933
2020-07-24 13:23:23 +02:00
Michał Gołębiowski-Owczarek
1712b9bbb2
Menu: Account for scrollbars in jQuery 3.2
jQuery >=3.2 doesn't include scrollbars in `.height()`, this commit switches
it to `.innerHeight()` which does so in jQuery >=3.3. In  jQuery 3.2 it doesn't
either so include scrollbars in innerHeight, add it back.

Using `.innerHeight()` instead of `.height()` should be fine as menu doesn't
define padding styles.

Closes gh-1929
2020-07-23 15:55:18 +02:00
Michał Gołębiowski-Owczarek
b61b16b5a8
All: Drop support for jQuery 1.7
Closes gh-1923
2020-07-22 16:04:47 +02:00