mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
refactor: use strict equals
This commit is contained in:
parent
9132bf8e5a
commit
e659d28354
11 changed files with 13 additions and 13 deletions
|
@ -39,7 +39,7 @@
|
||||||
xlg: size == "xlg",
|
xlg: size == "xlg",
|
||||||
max: size == "max",
|
max: size == "max",
|
||||||
};
|
};
|
||||||
$: if (size != undefined)
|
$: if (size !== undefined)
|
||||||
dispatch("change", { size, breakpointValue: breakpoints[size] });
|
dispatch("change", { size, breakpointValue: breakpoints[size] });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
if (selectorPrimaryFocus == null) return;
|
if (selectorPrimaryFocus == null) return;
|
||||||
const node =
|
const node =
|
||||||
(element || innerModal)?.querySelector(selectorPrimaryFocus) || buttonRef;
|
(element || innerModal)?.querySelector(selectorPrimaryFocus) || buttonRef;
|
||||||
if (node != null) node.focus();
|
if (node !== null) node.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
let opened = false;
|
let opened = false;
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
openDetail = e.target;
|
openDetail = e.target;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (target != null) {
|
$: if (target !== null) {
|
||||||
if (Array.isArray(target)) {
|
if (Array.isArray(target)) {
|
||||||
target.forEach((node) => node?.addEventListener("contextmenu", openMenu));
|
target.forEach((node) => node?.addEventListener("contextmenu", openMenu));
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
return () => {
|
return () => {
|
||||||
if (target != null) {
|
if (target !== null) {
|
||||||
if (Array.isArray(target)) {
|
if (Array.isArray(target)) {
|
||||||
target.forEach((node) =>
|
target.forEach((node) =>
|
||||||
node?.removeEventListener("contextmenu", openMenu)
|
node?.removeEventListener("contextmenu", openMenu)
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
|
|
||||||
<svelte:window
|
<svelte:window
|
||||||
on:contextmenu="{(e) => {
|
on:contextmenu="{(e) => {
|
||||||
if (target != null) return;
|
if (target !== null) return;
|
||||||
if (level > 1) return;
|
if (level > 1) return;
|
||||||
if (!ref) return;
|
if (!ref) return;
|
||||||
openMenu(e);
|
openMenu(e);
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
$: $tableRows = rows;
|
$: $tableRows = rows;
|
||||||
$: sortedRows = [...$tableRows];
|
$: sortedRows = [...$tableRows];
|
||||||
$: ascending = sortDirection === "ascending";
|
$: ascending = sortDirection === "ascending";
|
||||||
$: sorting = sortable && sortKey != null;
|
$: sorting = sortable && sortKey !== null;
|
||||||
$: sortingHeader = headers.find((header) => header.key === sortKey);
|
$: sortingHeader = headers.find((header) => header.key === sortKey);
|
||||||
$: if (sorting) {
|
$: if (sorting) {
|
||||||
if (sortDirection === "none") {
|
if (sortDirection === "none") {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
let menuRef = null;
|
let menuRef = null;
|
||||||
|
|
||||||
$: ctx.setOverflowVisible(menuRef != null);
|
$: ctx.setOverflowVisible(menuRef !== null);
|
||||||
$: if (menuRef) menuRef.style.top = "100%";
|
$: if (menuRef) menuRef.style.top = "100%";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
* @type {(url?: string) => void}
|
* @type {(url?: string) => void}
|
||||||
*/
|
*/
|
||||||
export const loadImage = (url) => {
|
export const loadImage = (url) => {
|
||||||
if (image != null) image = null;
|
if (image !== null) image = null;
|
||||||
loaded = false;
|
loaded = false;
|
||||||
error = false;
|
error = false;
|
||||||
image = new Image();
|
image = new Image();
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const item = localStorage.getItem(key);
|
const item = localStorage.getItem(key);
|
||||||
|
|
||||||
if (item != null) {
|
if (item !== null) {
|
||||||
try {
|
try {
|
||||||
value = JSON.parse(item);
|
value = JSON.parse(item);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
"Numeric input field with increment and decrement buttons";
|
"Numeric input field with increment and decrement buttons";
|
||||||
|
|
||||||
function parse(raw) {
|
function parse(raw) {
|
||||||
return raw != "" ? Number(raw) : null;
|
return raw !== "" ? Number(raw) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInput({ target }) {
|
function onInput({ target }) {
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
function parse(raw) {
|
function parse(raw) {
|
||||||
if ($$restProps.type !== "number") return raw;
|
if ($$restProps.type !== "number") return raw;
|
||||||
return raw != "" ? Number(raw) : null;
|
return raw !== "" ? Number(raw) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {(e: Event) => void} */
|
/** @type {(e: Event) => void} */
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
"li.bx--tree-node:not(.bx--tree-node--disabled)"
|
"li.bx--tree-node:not(.bx--tree-node--disabled)"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstFocusableNode != null) {
|
if (firstFocusableNode !== null) {
|
||||||
firstFocusableNode.tabIndex = "0";
|
firstFocusableNode.tabIndex = "0";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
let parentNode = node.parentNode;
|
let parentNode = node.parentNode;
|
||||||
|
|
||||||
while (parentNode != null && parentNode.getAttribute("role") !== "tree") {
|
while (parentNode !== null && parentNode.getAttribute("role") !== "tree") {
|
||||||
parentNode = parentNode.parentNode;
|
parentNode = parentNode.parentNode;
|
||||||
if (parentNode.tagName === "LI") depth++;
|
if (parentNode.tagName === "LI") depth++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue