Release 7.0.0
7.0.0 (2022-01-28)
Features
-
core dom: Hide method: also set hidden attribute for better semantics. (379e4a9)
-
core events: Standard JavaScript event factories - add "scroll" event. (949b1dc)
-
core events: Standard JavaScript event factories. (951084f)
Provide a library with standard JavaScript event factories, beginning withchanged
andsubmit
events. -
pat scroll-box: Allow detection of scroll-stop. (b226aeb)
Addscrolling-up
andscrolling-down
classes which will be removed after the user has stopped scrolling.
This allows for detection of a scrolling situation vs non-scrolling situation. -
pat scroll-box: Optimize performance. (9caf2be)
Optimize performance by grouping together DOM manipulation calls.
The browser is now able to better optimize the code in regard to the reflow/repaint cycles.
Also see: https://areknawo.com/dom-performance-case-study/ -
pat validation: Allow to define a custom error template. (986a092)
Bug Fixes
-
pat auto suggest: Do not change input field to type "hidden". (ab12b36)
Don't change the date field to a hidden field which would prevent it from validation.
Instead just hide it.
Also, do this not in the transform method but on initialization. -
pat auto suggest: Instead of searching for a reset button, listen on the form's reset event for clearing the data. (cd69e92)
-
pat auto suggest: Invoke standard JS change event. (31da974)
Work around the situation that a jQuery "change" event, submitted by select2, isn't caught by pat-validation.
Select2 also triggers a click event, which we will use here to trigger a standard JS change event. -
pat date picker: Do not change input field to type "hidden". (66f4333)
Don't change the date field to a hidden field which would prevent it from validation.
Instead just hide it.
Also disable click on label as this would focus/click-forward to the invisible input field and invokes some weird behavior. -
pat scroll-box: Immediately and correctly set CSS classes. (7e7fd23)
Fix pat-scroll-box to immediately and correctly set the CSS classes by using requestAnimationFrame instead timeouts.
Breaking Changes
- core dom create_from_string: Change create_from_string to be able to create multiple siblings from a string. (062991c)
Returns now a DocumentFragment instead of a single DOM node.
This method wasn't used in Patternslib or any of the core addons.
If you used it and it breaks your code, let me know. - core events: Move add_event_listener and remove_event_listener to core.events. (661b74c)
Move add_event_listener and remove_event_listener from core.dom to core.events.
Provide backwards compatibility imports in core.dom.
Those imports will be removed in an upcoming version. - pat validation: Refactor pat-validation for full HTML5 compatibility. (9999c8f)
-
Use the Web API validation framework.
-
Define custom errors with the Web API method
setCustomValidity
(e.g. the custom error for the start date not being after the end date with the notnot-after
option). -
Make use and set the Web API
validityState
according to validity of the form inputs. -
Making use of the Web API validation framework allows to use the
:invalid
and:valid
CSS selevtors - including for those inpyts with custom validity messages. -
Validate the form on
input
,change
,blur
andsubmit
events but make sure only one is run at once. -
Remove default validation error messages from the configuration.
If no validation message is defined the browser will show a default validation message, already translated into the language of the browser. -
Remove configuration option
type
.
Use thetype
attribute of the input element instead. For a date field, usedate
.
Forinteger
just usenumber
.
If you want to support real, floating numbers, usestep="any"
or a real number as step size. -
Remove dependency on validate.js.
Maintenance
-
Remove unused core/scroll_detection.js. (19779d2)
-
core parser: Minimal code simplification. (3c28bb2)
-
dependencies: Remove now unused dependency on validate.js. (d698930)
-
dependencies: Update browserslist database / caniuse-lite. (60ac00f)
-
dependencies: Upgrade dependencies. (9f0d41f)
-
docs: Add improve JSDoc strings a bit. (5f0f6ec)
-
pat ajax: Modernize code. (3953112)
-
tests: Use global instead of window in node based tools like Jest for registering global variables. (634325c)
-
Use caching in GitHub actions. (504e342)