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