prevent form and a tag default behaviour
This commit is contained in:
@@ -197,8 +197,16 @@ export class Replayer {
|
|||||||
) {
|
) {
|
||||||
mirror.map = rebuild(event.data.node, this.iframe.contentDocument!)[1];
|
mirror.map = rebuild(event.data.node, this.iframe.contentDocument!)[1];
|
||||||
// avoid form submit to refresh the iframe
|
// avoid form submit to refresh the iframe
|
||||||
this.iframe.contentDocument!.querySelectorAll('form').forEach(form => {
|
this.iframe.contentDocument!.addEventListener('submit', evt => {
|
||||||
form.addEventListener('submit', evt => evt.preventDefault());
|
if (evt.target && (evt.target as Element).tagName === 'FORM') {
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// avoid a link click to refresh the iframe
|
||||||
|
this.iframe.contentDocument!.addEventListener('click', evt => {
|
||||||
|
if (evt.target && (evt.target as Element).tagName === 'A') {
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user