From d9ffe4c736a1ede3c562b5425acc2618b2003a29 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Sun, 17 Feb 2019 15:54:14 +0800 Subject: [PATCH] check attribute is null instead of any falsy value --- src/replay/index.ts | 2 +- typings/record/collection.d.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 typings/record/collection.d.ts diff --git a/src/replay/index.ts b/src/replay/index.ts index 1c345fda..22df9d1e 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -409,7 +409,7 @@ export class Replayer { for (const attributeName in mutation.attributes) { if (typeof attributeName === 'string') { const value = mutation.attributes[attributeName]; - if (value) { + if (value !== null) { ((target as Node) as Element).setAttribute( attributeName, value, diff --git a/typings/record/collection.d.ts b/typings/record/collection.d.ts new file mode 100644 index 00000000..c6eb7fed --- /dev/null +++ b/typings/record/collection.d.ts @@ -0,0 +1,4 @@ +import { removedNodeMutation } from '../types'; +export declare function deepDelete(addsSet: Set, n: Node): void; +export declare function isParentRemoved(removes: removedNodeMutation[], n: Node): boolean; +export declare function isParentDropped(droppedSet: Set, n: Node): boolean;