Skip to content

Added spellcheck to the list of inherited input attributes #1404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<!-- Feel free to put either your handle and/or full name, according to
your privacy needs -->

* Added `spellcheck` to the list of `input` attributes that are inherited by selectize.

*@winzig*

## v0.12.4, v0.12.5 · 27 June 2018

* Allow the dropdown to reopen on click if it is closed without losing focus
by closeAfterSelect: true

*@fishpercolator*


* Fixed bug making `clearOptions` function. Now it doesn't remove already selected options.

*(thanks @caseymct - #1079)*
Expand Down
4 changes: 4 additions & 0 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ $.extend(Selectize.prototype, {
if ($input.attr('autocapitalize')) {
$control_input.attr('autocapitalize', $input.attr('autocapitalize'));
}

if ($input.attr('spellcheck')) {
$control_input.attr('spellcheck', $input.attr('spellcheck'));
}
$control_input[0].type = $input[0].type;

self.$wrapper = $wrapper;
Expand Down
4 changes: 3 additions & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@
});
describe('<input type="text" attributes>', function() {
it('should propagate original input attributes to the generated input', function() {
var test = setup_test('<input type="text" autocorrect="off" autocapitalize="none">', {});
var test = setup_test('<input type="text" autocorrect="off" autocapitalize="none" spellcheck="false">', {});
expect(test.selectize.$control_input.attr('autocorrect')).to.be.equal('off');
expect(test.selectize.$control_input.attr('autocapitalize')).to.be.equal('none');
expect(test.selectize.$control_input.attr('spellcheck')).to.be.equal('false');
});
it('should not add attributes if not present in the original', function() {
var test = setup_test('<input type="text">', {});
expect(test.selectize.$control_input.attr('autocorrect')).to.be.equal(undefined);
expect(test.selectize.$control_input.attr('autocapitalize')).to.be.equal(undefined);
expect(test.selectize.$control_input.attr('spellcheck')).to.be.equal(undefined);
});
});
});
Expand Down