From 5663ed12fccad254ffa02f462a84d94b9044f8db Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Fri, 28 Jun 2024 14:20:26 +0100 Subject: [PATCH] chore: remove map_set and map_get --- .../client/dom/elements/attributes.js | 6 ++--- packages/svelte/src/internal/client/utils.js | 27 ------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/elements/attributes.js b/packages/svelte/src/internal/client/dom/elements/attributes.js index d09667dd90..c65acc9a24 100644 --- a/packages/svelte/src/internal/client/dom/elements/attributes.js +++ b/packages/svelte/src/internal/client/dom/elements/attributes.js @@ -1,6 +1,6 @@ import { DEV } from 'esm-env'; import { hydrating } from '../hydration.js'; -import { get_descriptors, get_prototype_of, map_get, map_set } from '../../utils.js'; +import { get_descriptors, get_prototype_of } from '../../utils.js'; import { AttributeAliases, DelegatedEvents, @@ -166,8 +166,8 @@ export function set_attributes(element, prev, next, lowercase_attributes, css_ha next.class = ''; } - var setters = map_get(setters_cache, element.nodeName); - if (!setters) map_set(setters_cache, element.nodeName, (setters = get_setters(element))); + var setters = setters_cache.get(element.nodeName); + if (!setters) setters_cache.set(element.nodeName, (setters = get_setters(element))); // @ts-expect-error var attributes = /** @type {Record} **/ (element.__attributes ??= {}); diff --git a/packages/svelte/src/internal/client/utils.js b/packages/svelte/src/internal/client/utils.js index 6c6b9cc546..6b7cba30b8 100644 --- a/packages/svelte/src/internal/client/utils.js +++ b/packages/svelte/src/internal/client/utils.js @@ -13,33 +13,6 @@ export var object_prototype = Object.prototype; export var array_prototype = Array.prototype; export var get_prototype_of = Object.getPrototypeOf; -/** @type {Map} */ -var map_prototype = Map.prototype; -var map_set_method = map_prototype.set; -var map_get_method = map_prototype.get; - -/** - * @template K - * @template V - * @param {Map} map - * @param {K} key - * @param {V} value - */ -export function map_set(map, key, value) { - map_set_method.call(map, key, value); -} - -/** - * @template K - * @template V - * @param {Map} map - * @param {K} key - * @return {V} - */ -export function map_get(map, key) { - return map_get_method.call(map, key); -} - /** * @param {any} thing * @returns {thing is Function}