Fix the default parameters in JS

This was causing major issues in IE.
This commit is contained in:
Luka Murn 2016-08-31 14:04:45 +02:00
parent bd414c8b4f
commit 5cb79f6282
3 changed files with 9 additions and 4 deletions

View file

@ -1,4 +1,5 @@
function initCommentOptions(scrollableContainer, useParentOffset = true) {
function initCommentOptions(scrollableContainer, useParentOffset) {
useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true;
scrollCommentOptions($(".dropdown-comment"), useParentOffset);
// Reposition dropdown to the left
@ -25,7 +26,8 @@ function initCommentOptions(scrollableContainer, useParentOffset = true) {
}, true);
}
function scrollCommentOptions(selector, useParentOffset = true) {
function scrollCommentOptions(selector, useParentOffset) {
useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true;
_.each(selector, function(el) {
var $el = $(el);
var offset = useParentOffset ? $el.offset().top : $el.position().top;

View file

@ -5,7 +5,8 @@
/*
* Render errors specified in JSON format for many form elements.
*/
$.fn.renderFormErrors = function (modelName, errors, clear = true, ev) {
$.fn.renderFormErrors = function (modelName, errors, clear, ev) {
clear = (typeof clear !== 'undefined') ? clear : true;
if (clear || _.isUndefined(clear)) {
this.clearFormErrors();
}

View file

@ -18,7 +18,9 @@ $.fn.onSubmitValidator = function(validatorCb) {
}
};
function textValidator(ev, textInput, canBeBlank = false, limitLength = true) {
function textValidator(ev, textInput, canBeBlank) {
canBeBlank = (typeof canBeBlank !== 'undefined') ? canBeBlank : false;
limitLength = (typeof limitLength !== 'undefined') ? limitLength : true;
var nameTooShort = $(textInput).val().length === 0;
var nameTooLong = $(textInput).val().length > 50;
var errMsg;