From 52489e05c390eb9714e6a94d486e8b1db8294530 Mon Sep 17 00:00:00 2001 From: Ivan Hofer Date: Fri, 22 Jul 2022 09:47:09 +0200 Subject: [PATCH] Revert "get rid of `blank_object`" This reverts commit 9e51c8612dece588ffd123713266df891c5766c9. --- src/runtime/internal/Component.ts | 6 +++--- src/runtime/internal/ssr.ts | 4 ++-- src/runtime/internal/utils.ts | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index f0ddc12133..fba7f0faa7 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -1,6 +1,6 @@ import { add_render_callback, flush, schedule_update, dirty_components } from './scheduler'; import { current_component, set_current_component } from './lifecycle'; -import { is_empty, is_function, run, run_all, noop } from './utils'; +import { blank_object, is_empty, is_function, run, run_all, noop } from './utils'; import { children, detach, start_hydrating, end_hydrating } from './dom'; import { transition_in } from './transitions'; @@ -116,7 +116,7 @@ export function init(component, options, instance, create_fragment, not_equal, p props, update: noop, not_equal, - bound: {}, + bound: blank_object(), // lifecycle on_mount: [], @@ -127,7 +127,7 @@ export function init(component, options, instance, create_fragment, not_equal, p context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), // everything else - callbacks: {}, + callbacks: blank_object(), dirty, skip_bound: false, root: options.target || parent_component.$$.root diff --git a/src/runtime/internal/ssr.ts b/src/runtime/internal/ssr.ts index 27c4a47a45..dc4c16dffb 100644 --- a/src/runtime/internal/ssr.ts +++ b/src/runtime/internal/ssr.ts @@ -1,5 +1,5 @@ import { set_current_component, current_component } from './lifecycle'; -import { run_all } from './utils'; +import { run_all, blank_object } from './utils'; import { boolean_attributes } from '../../shared/boolean_attributes'; export { is_void } from '../../shared/utils/names'; @@ -150,7 +150,7 @@ export function create_ssr_component(fn) { on_mount: [], before_update: [], after_update: [], - callbacks: {} + callbacks: blank_object() }; set_current_component({ $$ }); diff --git a/src/runtime/internal/utils.ts b/src/runtime/internal/utils.ts index 24cb5d8b57..c24ee5a7fb 100644 --- a/src/runtime/internal/utils.ts +++ b/src/runtime/internal/utils.ts @@ -24,6 +24,10 @@ export function run(fn) { return fn(); } +export function blank_object() { + return Object.create(null); +} + export function run_all(fns: Function[]) { fns.forEach(run); }