You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spend a while debugging the culprit of an strange exception in Chrome, which doesn't happen in other browsers: Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('submit') does not support selection.
Debugging and catching an exception showed me off the line this.model.isValid(true) and method flatten() within the backbone-validation-amd.js module.
Prehistory how it happens and how to reproduce:
there was the need to store one of jQuery selectors within the backbone.model attributes. When flatten() method itterates
it goes through the whole structure of jQuery selector and nested properties. For my bad/good luck, this selector contained the submit button, which throws InvalidStateError exception on iteration of properties in latest Chrome, though it works great in FF and Opera browsers at the same time.
The solution is really simple, to exlude the case when model attributes for some reason contain selectors, just add another check to the list of checks to the flatten(), at line 80:
...
val instanceof Backbone.Collection ||
val instanceof jQuery) // <=== here
) {
...
The text was updated successfully, but these errors were encountered:
Spend a while debugging the culprit of an strange exception in Chrome, which doesn't happen in other browsers:
Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('submit') does not support selection.
Debugging and catching an exception showed me off the line
this.model.isValid(true)
and methodflatten()
within the backbone-validation-amd.js module.Prehistory how it happens and how to reproduce:
there was the need to store one of jQuery selectors within the
backbone.model
attributes. Whenflatten()
method itteratesit goes through the whole structure of jQuery selector and nested properties. For my bad/good luck, this selector contained the submit button, which throws
InvalidStateError
exception on iteration of properties in latest Chrome, though it works great in FF and Opera browsers at the same time.The solution is really simple, to exlude the case when model attributes for some reason contain selectors, just add another check to the list of checks to the
flatten()
, at line 80:The text was updated successfully, but these errors were encountered: