avoid style sheet rules index overflow
This commit is contained in:
@@ -297,6 +297,7 @@ export class Replayer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.missingNodeRetryMap = {};
|
this.missingNodeRetryMap = {};
|
||||||
|
console.log('rebuild map');
|
||||||
mirror.map = rebuild(event.data.node, this.iframe.contentDocument!)[1];
|
mirror.map = rebuild(event.data.node, this.iframe.contentDocument!)[1];
|
||||||
const styleEl = document.createElement('style');
|
const styleEl = document.createElement('style');
|
||||||
const { documentElement, head } = this.iframe.contentDocument!;
|
const { documentElement, head } = this.iframe.contentDocument!;
|
||||||
@@ -625,7 +626,11 @@ export class Replayer {
|
|||||||
|
|
||||||
if (d.adds) {
|
if (d.adds) {
|
||||||
d.adds.forEach(({ rule, index }) => {
|
d.adds.forEach(({ rule, index }) => {
|
||||||
styleSheet.insertRule(rule, index);
|
const _index =
|
||||||
|
index === undefined
|
||||||
|
? undefined
|
||||||
|
: Math.min(index, styleSheet.rules.length);
|
||||||
|
styleSheet.insertRule(rule, _index);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user