Skip to content

Commit

Permalink
Check for input type before event accumulation. (#582)
Browse files Browse the repository at this point in the history
* Check for input type before event accumulation.

Safari throws a TypeError when selection* is indexed on a DOM node.

* Bump version
  • Loading branch information
dmjio committed May 17, 2020
1 parent 15a1a4c commit f4cc27e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/miso-examples.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: miso-examples
version: 1.5.1.0
version: 1.5.2.0
category: Web, Miso, Data Structures
author: David M. Johnson <[email protected]>
maintainer: David M. Johnson <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion jsbits/delegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ window['objectToJSON'] = function objectToJSON (at, obj) {

/* If obj is a non-list-like object */
newObj = {};
var isInput = obj['localName'] === 'input';
for (var i in obj){
/* bug in safari, throws TypeError if the following fields are referenced on a checkbox */
/* https://stackoverflow.com/a/25569117/453261 */
/* https://html.spec.whatwg.org/multipage/input.html#do-not-apply */
if (obj['type'] == 'checkbox' && (i === 'selectionDirection' || i === 'selectionStart' || i === 'selectionEnd'))
if (isInput && (i === 'selectionDirection' || i === 'selectionStart' || i === 'selectionEnd'))
continue;
if (typeof obj[i] == 'string' || typeof obj[i] == 'number' || typeof obj[i] == 'boolean')
newObj[i] = obj[i];
Expand Down
2 changes: 1 addition & 1 deletion miso.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: miso
version: 1.5.1.0
version: 1.5.2.0
category: Web, Miso, Data Structures
license: BSD3
license-file: LICENSE
Expand Down

0 comments on commit f4cc27e

Please sign in to comment.