diff --git a/HISTORY.md b/HISTORY.md index b0feec8..b14cda4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ https://github.com/josdejong/jsoneditor +## not yet published, version 7.3.2 + +- Fixed #850: make autocomplete options robust against non-string inputs + like `null`, `123`, `true`, `false`. + + ## 2019-12-01, version 7.3.1 - Fixed #855: `onFocus` and `onBlur` not working in modes `text` and `code` diff --git a/examples/11_autocomplete_basic.html b/examples/11_autocomplete_basic.html index b17a60d..20b04f0 100644 --- a/examples/11_autocomplete_basic.html +++ b/examples/11_autocomplete_basic.html @@ -32,7 +32,7 @@ const options = { autocomplete: { getOptions: function () { - return ['apple', 'cranberry', 'raspberry', 'pie', 'mango', 'mandarine', 'melon', 'appleton']; + return ['apple', 'cranberry', 'raspberry', 'pie', 'mango', 'mandarine', 'melon', 'appleton', null, "nothing", false, true, 1234, 123]; } } } diff --git a/src/js/autocomplete.js b/src/js/autocomplete.js index 692f84b..ada0663 100644 --- a/src/js/autocomplete.js +++ b/src/js/autocomplete.js @@ -191,7 +191,7 @@ export function autocomplete (config) { dropDown.style.marginLeft = '0' dropDown.style.marginTop = element.getBoundingClientRect().height + 'px' - this.options = options + this.options = options.map(String) if (this.element !== element) { this.element = element