fix typings
This commit is contained in:
@@ -1058,7 +1058,7 @@ export class Replayer {
|
|||||||
|
|
||||||
private applyMutation(d: mutationData, useVirtualParent: boolean) {
|
private applyMutation(d: mutationData, useVirtualParent: boolean) {
|
||||||
d.removes.forEach((mutation) => {
|
d.removes.forEach((mutation) => {
|
||||||
const target = this.mirror.getNode(mutation.id);
|
let target = this.mirror.getNode(mutation.id);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
if (d.removes.find((r) => r.id === mutation.parentId)) {
|
if (d.removes.find((r) => r.id === mutation.parentId)) {
|
||||||
// no need to warn, parent was already removed
|
// no need to warn, parent was already removed
|
||||||
@@ -1096,7 +1096,14 @@ export class Replayer {
|
|||||||
parent.removeChild(target);
|
parent.removeChild(target);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof DOMException) {
|
if (error instanceof DOMException) {
|
||||||
this.warn('parent could not remove child in mutation', parent, realParent, target, realTarget , d);
|
this.warn(
|
||||||
|
'parent could not remove child in mutation',
|
||||||
|
parent,
|
||||||
|
realParent,
|
||||||
|
target,
|
||||||
|
realTarget,
|
||||||
|
d,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -1349,16 +1356,16 @@ export class Replayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (attributeName === 'style') {
|
} else if (attributeName === 'style') {
|
||||||
let styleValues = (value as styleAttributeValue);
|
let styleValues = value as styleAttributeValue;
|
||||||
const targetEl = ((target as Node) as HTMLElement);
|
const targetEl = (target as Node) as HTMLElement;
|
||||||
for (var s in styleValues) {
|
for (var s in styleValues) {
|
||||||
if (styleValues[s] === false) {
|
if (styleValues[s] === false) {
|
||||||
targetEl.style.removeProperty(s);
|
targetEl.style.removeProperty(s);
|
||||||
} else if (styleValues[s] instanceof Array) {
|
} else if (styleValues[s] instanceof Array) {
|
||||||
const svp = (styleValues[s] as styleValueWithPriority);
|
const svp = styleValues[s] as styleValueWithPriority;
|
||||||
targetEl.style.setProperty(s, svp[0], svp[1]);
|
targetEl.style.setProperty(s, svp[0], svp[1]);
|
||||||
} else {
|
} else {
|
||||||
const svs = (styleValues[s] as string)
|
const svs = styleValues[s] as string;
|
||||||
targetEl.style.setProperty(s, svs);
|
targetEl.style.setProperty(s, svs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1598,9 +1605,13 @@ export class Replayer {
|
|||||||
|
|
||||||
private restoreNodeSheet(node: INode) {
|
private restoreNodeSheet(node: INode) {
|
||||||
const storedRules = this.virtualStyleRulesMap.get(node);
|
const storedRules = this.virtualStyleRulesMap.get(node);
|
||||||
if (node.nodeName !== 'STYLE') return;
|
if (node.nodeName !== 'STYLE') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!storedRules) return;
|
if (!storedRules) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const styleNode = (node as unknown) as HTMLStyleElement;
|
const styleNode = (node as unknown) as HTMLStyleElement;
|
||||||
|
|
||||||
@@ -1608,7 +1619,7 @@ export class Replayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private warnNodeNotFound(d: incrementalData, id: number) {
|
private warnNodeNotFound(d: incrementalData, id: number) {
|
||||||
if (this.treeIndex.removeIdSet.has(id)) {
|
if (this.treeIndex['removeIdSet'].has(id)) {
|
||||||
this.warn(`Node with id '${id}' was previously removed. `, d);
|
this.warn(`Node with id '${id}' was previously removed. `, d);
|
||||||
} else {
|
} else {
|
||||||
this.warn(`Node with id '${id}' not found. `, d);
|
this.warn(`Node with id '${id}' not found. `, d);
|
||||||
@@ -1630,8 +1641,12 @@ export class Replayer {
|
|||||||
* is microtask, so events fired on a removed DOM may emit
|
* is microtask, so events fired on a removed DOM may emit
|
||||||
* snapshots in the reverse order.
|
* snapshots in the reverse order.
|
||||||
*/
|
*/
|
||||||
if (this.treeIndex.removeIdSet.has(id)) {
|
if (this.treeIndex['removeIdSet'].has(id)) {
|
||||||
this.debug(REPLAY_CONSOLE_PREFIX, `Node with id '${id}' was previously removed. `, d);
|
this.debug(
|
||||||
|
REPLAY_CONSOLE_PREFIX,
|
||||||
|
`Node with id '${id}' was previously removed. `,
|
||||||
|
d,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.debug(REPLAY_CONSOLE_PREFIX, `Node with id '${id}' not found. `, d);
|
this.debug(REPLAY_CONSOLE_PREFIX, `Node with id '${id}' not found. `, d);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user