如何检测浏览器对Input Events Level 1或Level 2的支持?
Right now, browser input event support has matured enough that we can categorize it into at least three distinct tiers (beyond just "not supported"), based on the recent history of W3C specifications tracked on GitHub:
InputEvents Level 0 (de facto baseline)
This is the most basic support tier, where browsers don’t offer theinputTypeproperty or thebeforeinputevent. You’re limited to the originalinputevent with no extra context about what specific action triggered the input change.InputEvents Level 1
This tier brings critical advanced features: thebeforeinputevent (which fires before the DOM gets updated, letting you intercept and adjust input actions early) and theinputTypeproperty (which tells you exactly what type of input occurred—like inserting plain text, deleting via backspace, pasting content, etc.). This was the first major step forward for modern input event handling in browsers.InputEvents Level 2
Building on Level 1, this tier adds a set of newinputTypevalues tailored for composition input scenarios (think Chinese, Japanese, or Korean input methods where users select characters from candidate lists). Examples includedeleteByCompositionandinsertCompositionText, which let you handle the unique flow of composed input far more accurately.
内容的提问来源于stack exchange,提问作者ecmanaut

