1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add prefer optional chaining rule

This commit is contained in:
Bill Thornton 2023-07-06 13:39:48 -04:00
parent ec0adb895b
commit f35a8151e0
61 changed files with 152 additions and 152 deletions

View file

@ -12,7 +12,7 @@ if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
// descriptor returning null in webos
if (descriptor && descriptor.configurable) {
if (descriptor?.configurable) {
const baseSetMethod = descriptor.set;
descriptor.set = function (value) {
baseSetMethod.call(this, value);

View file

@ -37,7 +37,7 @@ function onContextMenu(e) {
const card = dom.parentWithAttribute(target, 'data-id');
// check for serverId, it won't be present on selectserver
if (card && card.getAttribute('data-serverid')) {
if (card?.getAttribute('data-serverid')) {
inputManager.handleCommand('menu', {
sourceElement: card
});
@ -357,7 +357,7 @@ ItemsContainerPrototype.resume = function (options) {
}
}
if (this.needsRefresh || (options && options.refresh)) {
if (this.needsRefresh || (options?.refresh)) {
return this.refreshItems();
}

View file

@ -132,7 +132,7 @@ EmbyPlaystateButtonPrototype.setItem = function (item) {
this.setAttribute('data-serverid', item.ServerId);
this.setAttribute('data-type', item.Type);
const played = item.UserData && item.UserData.Played;
const played = item.UserData?.Played;
setState(this, played);
bindEvents(this);
} else {

View file

@ -14,7 +14,7 @@ let supportsValueSetOverride = false;
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
// descriptor returning null in webos
if (descriptor && descriptor.configurable) {
if (descriptor?.configurable) {
supportsValueSetOverride = true;
}
}
@ -167,7 +167,7 @@ function setMarker(range, valueMarker, marker, valueProgress) {
}
function updateMarkers(range, currentValue) {
if (range.markerInfo && range.markerInfo.length && range.markerElements && range.markerElements.length) {
if (range.markerInfo?.length && range.markerElements?.length) {
for (let i = 0, length = range.markerElements.length; i < length; i++) {
if (range.markerInfo.length > i) {
setMarker(range, mapFractionToValue(range, range.markerInfo[i].progress), range.markerElements[i], currentValue);

View file

@ -74,7 +74,7 @@ if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value');
// descriptor returning null in webos
if (descriptor && descriptor.configurable) {
if (descriptor?.configurable) {
const baseSetMethod = descriptor.set;
descriptor.set = function (value) {
baseSetMethod.call(this, value);