This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
Spinner: use data attributes when initialising indirectly #1206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the options for a Spinner are declared as data attributes, the data attributes are only used during instantiation if the Spinner is initialised via the user performing a mousedown event on the element (data attributes API).
If you call a Spinner method on an element prior to instantiation, the Spinner will get instantiated but the data attributes aren't passed through.
I have a use case where my Spinner starts off in a disabled state, and I enable it later if the user performs a certain action. In this case, the
data-min
anddata-max
values from my markup don't get applied because the call todisable
initialises the Spinner without using the data attributes. Then, when I enable the Spinner later, I am able to go belowdata-min
and abovedata-max
(the default limits of1
and999
are applied instead). This JSFiddle demonstrates the issue. I haven't checked to see if any of the other plugins have the same issue.