Fix inline link elements bug (#995)
* fix: bug when inlined link elements * test: update snapshot for test cases * apply Justin's review suggestions 1. make Mirror's replace function act the same with the original one when there's no existed node to get replaced. 2. when replacing with the link/style elements, keep their existing attributes to prevent potential bugs
This commit is contained in:
@@ -389,6 +389,11 @@ export class Mirror implements IMirror<RRNode> {
|
||||
}
|
||||
|
||||
replace(id: number, n: RRNode) {
|
||||
const oldNode = this.getNode(id);
|
||||
if (oldNode) {
|
||||
const meta = this.nodeMetaMap.get(oldNode);
|
||||
if (meta) this.nodeMetaMap.set(n, meta);
|
||||
}
|
||||
this.idNodeMap.set(id, n);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user