从Chrome 53开始,不受信任的事件不再调用默认操作。https://developer.mozilla.org/zh-CN/docs/Web/API/Event/isTrusted
在Chrome 53之前,此JavaScript会添加一个interrobang?。
var e = document.createEvent('TextEvent');
e.initTextEvent('textInput',
true,
true,
null,
String.fromCharCode( 8253 ));
document.activeElement.dispatchEvent(e);
Run Code Online (Sandbox Code Playgroud)
在Chrome 53中,看看会发生什么:https://jsfiddle.net/dblume/2nfhrj1j/10/
由于使用createEvent()进行的事件是不受信任的事件,因此不会像在Chrome 52及之前的版本中那样由activeElement处理其数据。
从Chrome 53开始,我的Chrome扩展程序停止运行,因为它试图调度此类textInput事件。现在应该怎么办?