Skip to content

Commit

Permalink
fix(chore): replace jquery trim with vanilla js
Browse files Browse the repository at this point in the history
Replaces the used jquery trim methods by its native vanilla javascript variant. As of jquery 3.5.0 the trim method gets deprecated
  • Loading branch information
lubber-de authored Apr 16, 2020
1 parent 40642d3 commit 323e608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/definitions/behaviors/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ $.fn.form = function(parameters) {
}
},
blank: function($field) {
return $.trim($field.val()) === '';
return String($field.val()).trim() === '';
},
valid: function(field) {
var
Expand Down Expand Up @@ -1264,7 +1264,7 @@ $.fn.form = function(parameters) {
// cast to string avoiding encoding special values
value = (value === undefined || value === '' || value === null)
? ''
: (settings.shouldTrim) ? $.trim(value + '') : String(value + '')
: (settings.shouldTrim) ? String(value + '').trim() : String(value + '')
;
return ruleFunction.call(field, value, ancillary, $module);
}
Expand Down
10 changes: 5 additions & 5 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ $.fn.dropdown = function(parameters) {
return $text.text();
},
query: function() {
return $.trim($search.val());
return String($search.val()).trim();
},
searchWidth: function(value) {
value = (value !== undefined)
Expand Down Expand Up @@ -1916,8 +1916,8 @@ $.fn.dropdown = function(parameters) {
return ($choice.data(metadata.text) !== undefined)
? $choice.data(metadata.text)
: (preserveHTML)
? $.trim($choice.html())
: $.trim($choice.text())
? $choice.html().trim()
: $choice.text().trim()
;
}
},
Expand All @@ -1929,11 +1929,11 @@ $.fn.dropdown = function(parameters) {
return ($choice.data(metadata.value) !== undefined)
? String( $choice.data(metadata.value) )
: (typeof choiceText === 'string')
? $.trim(
? String(
settings.ignoreSearchCase
? choiceText.toLowerCase()
: choiceText
)
).trim()
: String(choiceText)
;
},
Expand Down

0 comments on commit 323e608

Please sign in to comment.