Refactor to not use pseudo jQuery selector ':emptyVal'
This commit is contained in:
parent
cb94fd1940
commit
4dd8fa655e
@ -433,11 +433,15 @@
|
|||||||
* (Event) ev - the submit event.
|
* (Event) ev - the submit event.
|
||||||
*/
|
*/
|
||||||
if (ev && ev.preventDefault) { ev.preventDefault(); }
|
if (ev && ev.preventDefault) { ev.preventDefault(); }
|
||||||
var $empty_inputs = this.$('input.required:emptyVal');
|
var has_empty_inputs = _.reduce(document.querySelectorAll('input.required'),
|
||||||
if ($empty_inputs.length) {
|
function (result, input) {
|
||||||
$empty_inputs.addClass('error');
|
if (input.value === '') {
|
||||||
return;
|
input.classList.add('error');
|
||||||
}
|
return result + 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, 0);
|
||||||
|
if (has_empty_inputs) { return; }
|
||||||
var $inputs = $(ev.target).find(':input:not([type=button]):not([type=submit])'),
|
var $inputs = $(ev.target).find(':input:not([type=button]):not([type=submit])'),
|
||||||
iq = $iq({type: "set"}).c("query", {xmlns:Strophe.NS.REGISTER});
|
iq = $iq({type: "set"}).c("query", {xmlns:Strophe.NS.REGISTER});
|
||||||
|
|
||||||
|
@ -63,10 +63,6 @@
|
|||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
|
||||||
$.expr[':'].emptyVal = function(obj){
|
|
||||||
return obj.value === '';
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.hasScrollBar = function() {
|
$.fn.hasScrollBar = function() {
|
||||||
if (!$.contains(document, this.get(0))) {
|
if (!$.contains(document, this.get(0))) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user