Skip to content

Commit

Permalink
Use trim method as trim isn't a property (#9605)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarnef authored Feb 21, 2021
1 parent 980acaf commit 5e4d326
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,19 @@ Use this directive to construct a header inside the main editor window.
}

}
scope.accessibility.a11yMessageVisible = !isEmptyOrSpaces(scope.accessibility.a11yMessage);
scope.accessibility.a11yNameVisible = !isEmptyOrSpaces(scope.accessibility.a11yName);

scope.accessibility.a11yMessageVisible = !isNullOrWhitespace(scope.accessibility.a11yMessage);
scope.accessibility.a11yNameVisible = !isNullOrWhitespace(scope.accessibility.a11yName);

});
}



function isEmptyOrSpaces(str) {
return str === null || str===undefined || str.trim ==='';
function isNullOrWhitespace(str) {
return str === null || str === undefined || str.trim() === '';
}

function SetPageTitle(title) {
scope.$emit("$changeTitle", title);
scope.$emit("$changeTitle", title);
}

var unbindEventHandler = $rootScope.$on('$setAccessibleHeader', function (event, isNew, editorFor, nameLocked, name, contentTypeName, setTitle) {
Expand Down
25 changes: 13 additions & 12 deletions src/Umbraco.Web.UI.Client/src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,29 @@
const isScope = obj => obj && obj.$evalAsync && obj.$watch;

const toJsonReplacer = (key, value) => {
var val = value;
var val = value;
if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
val = undefined;
val = undefined;
} else if (isWindow(value)) {
val = '$WINDOW';
} else if (value && window.document === value) {
val = '$DOCUMENT';
val = '$WINDOW';
} else if (value && window.document === value) {
val = '$DOCUMENT';
} else if (isScope(value)) {
val = '$SCOPE';
}
val = '$SCOPE';
}
return val;
}
};

/**
* Equivalent to angular.toJson
*/
const toJson = (obj, pretty) => {
if (isUndefined(obj)) return undefined;
if (!isNumber(pretty)) {
pretty = pretty ? 2 : null;
pretty = pretty ? 2 : null;
}
return JSON.stringify(obj, toJsonReplacer, pretty);
}
};

/**
* Equivalent to angular.fromJson
Expand All @@ -102,7 +103,7 @@
return val;
}
return JSON.parse(val);
}
};

/**
* Not equivalent to angular.forEach. But like the angularJS method this does not fail on null or undefined.
Expand All @@ -112,7 +113,7 @@
return obj.forEach(iterator);
}
return obj;
}
};

let _utilities = {
noop: noop,
Expand Down

0 comments on commit 5e4d326

Please sign in to comment.