spellcheck

spellcheck 全局属性enumerated 属性,定义是否可以检查元素是否存在拼写错误。

¥The spellcheck global attribute is an enumerated attribute that defines whether the element may be checked for spelling errors.

注意:该属性只是给浏览器的一个提示:浏览器不需要检查拼写错误。通常,即使 spellcheck 属性设置为 true 并且浏览器支持拼写检查,也不会检查不可编辑元素的拼写错误。

¥Note: This attribute is merely a hint for the browser: browsers are not required to check for spelling errors. Typically non-editable elements are not checked for spelling errors, even if the spellcheck attribute is set to true and the browser supports spellchecking.

Try it

它可能具有以下值:

¥It may have the following values:

  • 空字符串或 true,表示如果可能的话,应检查该元素是否存在拼写错误;
  • false,表示不应检查该元素是否存在拼写错误。

如果未设置此属性,则其默认值为元素类型和浏览器定义。该默认值也可以被继承,这意味着仅当元素内容最近的祖级的拼写检查状态为 true 时,才会检查元素内容是否存在拼写错误。

¥If this attribute is not set, its default value is element-type and browser-defined. This default value may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true.

安全和隐私问题

¥Security and privacy concerns

使用拼写检查可能会对用户的安全和隐私产生影响。该规范没有规定如何进行拼写检查,并且可以将元素的内容发送给第三方以获得拼写检查结果(请参阅 增强的拼写检查和 "spell-jacking")。

¥Using spellchecking can have consequences for users' security and privacy. The specification does not regulate how spellchecking is done and the content of the element may be sent to a third party for spellchecking results (see enhanced spellchecking and "spell-jacking").

对于可能包含敏感信息的元素,你应该考虑将 spellcheck 设置为 false

¥You should consider setting spellcheck to false for elements that can contain sensitive information.

规范

Specification
HTML Standard
# attr-spellcheck

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also