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.
Kenneth DeBacker [Thu, 30 Mar 2023 11:05:41 +0000 (07:05 -0400)]
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/
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. `<em>test</em>` 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.
Unfortunately, we cannot update all of them to their latest versions as some
of them now require Node.js 12 and we need to be able to build on Node 10 as
that's what our Jenkins runs.
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.
Ben Mullins [Wed, 5 Jan 2022 10:35:34 +0000 (05:35 -0500)]
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.
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.
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.
Josep Sanz [Mon, 8 Nov 2021 10:53:45 +0000 (11:53 +0100)]
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>
A fix from 43254468de7d69b5422e667ba7ebbe864fc34a63 introduced a rule setting
`background-image` of a blank icon to none. However, the selector used for that
rule had lower specificity than another one: `.ui-button .ui-icon` which caused
dashes being shown over the icons.
We needed to increase the specificity of the `.ui-icon-blank` rule past the
above selector and past `.ui-button:hover .ui-icon`. We're doing it by repeating
the class name three times.
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.
Build: Don't save temporary npm dependencies to package.json
Past npm versions required the `--save` flag to save anything in `package.json`
when installing packages but newer ones do this by default. Pass `--no-save` to
restore the original behavior in the `release-test.js` script.
jQuery UI 1.12.1 was released using an outdated (at the time of its release)
version of the download.jqueryui.com package; the latest ones wouldn't generate
relevant JS files.
This commit accounts for the changes so that the latest version can be used.
Patrick McKay [Sun, 1 Mar 2020 13:13:05 +0000 (07:13 -0600)]
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.
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.
Tests: Fix the "dialog: core: focus tabbable" test in IE
In IE in jQuery 3.4+ a sequence:
```js
$( inputNode ).trigger( "focus" ).trigger( "blur" ).trigger( "focus" );
```
doesn't end up with a focused input. However, in this test we only want to check
that the last focused input receives the focus back when `_focusTabbable()` is
called which in reality doesn't happen so quickly so let's avoid the issue by
waiting a bit.
Some bad pages are being detected as Catalan randomly which makes the build
fail. This is reproducible both locally & on Travis. PR gh-1949 added a new
regex to account for this error but it didn't escape parens properly so it's
not matching the problematic error message.
Some bad pages are being detected as Catalan randomly which makes the build
fail. This is reproducible both locally & on Travis. This commit adds a new
regex to account for this error.
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.
Tests: Account for an extra noop focus/blur listener in jQuery >=3.4
jQuery >=3.4.0 uses a special focus/blur handler pair needed to fix various
issues with checkboxes/radio buttons as well as being able to pass data in focus
triggers. This leaves extra focus & blur events if any of these events were ever
listened to at a particular element.
We've started skipping these handlers in the `domEqual` assertion in gh-1930 but
we missed a case where an event is triggered before any handler is attached -
jQuery >=3.4.0 attaches then an extra noop listener just to force the code path
to go through the setup code before the trigger happens. We now skip this extra
handler as well.
This fixes a test failure in "dialog: methods" destroy tests.
Core: Resolve csslint issues with the IE filter property
IE filter property violates standard CSS parsing rules. Because of that, IE 8
added `-ms-filter` which accepts the same values but quoted:
https://web.archive.org/web/20101112132308/http://blogs.msdn.com/b/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspx
Both `filter` & `-ms-filter` serialize to the same `filter` property in
`currentStyle`.
This commit switches to that new property to resolve csslint issues.
Paul Capron [Wed, 14 Oct 2020 21:53:11 +0000 (23:53 +0200)]
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 d3025968f34 introduced a regression by testing with `!== "hidden"`
instead of `=== "visible"`.
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;
```
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.
Tests: Account for extra focus/blur listeners in jQuery >=3.4
jQuery >=3.4.0 uses a special focus/blur handler pair
needed to fix various issues with checkboxes/radio buttons
as well as being able to pass data in focus triggers.
However, this leaves dummy focus & blur events if any of these
events were ever listened to at a particular element. There's not
a lot UI can do to fix this so we now just skip these handlers for
data comparisons in tests.
Ref jquery/jquery#4496
Closes gh-1930
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Tests: Accept a small difference of animated width/height
jQuery 3.2 & newer have a different animation logic and the animated elements
width/height differ from the starting ones even at the beginning of the
animation. The point of the assertions checking that they're identical was
to ensure bug #5245 is fixed; that issue manifested by a big jump to half the
element size. To test for that, it's enough to check that the first obtained
values are close to the original ones.
This makes effects tests pass in all supported jQuery versions.
jQuery 3.2 incorrectly handle scrollbars in WebKit/Blink-based browsers.
This is fixed in version 3.3, see https://github.com/jquery/jquery/issues/3589.
As the data here comes from jQuery directly and the changes to fix it
are non-trivial: https://github.com/jquery/jquery/pull/3656, just accept
that scrollbar data in this jQuery version is inaccurate.