ConstrainDOMString - Web APIs 编辑

The ConstrainDOMString dictionary is used to specify a constraint for a property whose value is a string. It allows you to specify one or more exact string values from which one must be the parameter's value, or a set of ideal values which should be used if possible. You can also specify a single string (or an array of strings) which the user agent will do its best to match once all more stringent constraints have been applied.

Properties

The value of a ConstrainDOMString can be any of the following:

  • A single DOMString
  • An array of DOMString objects
  • An object with one or both of the following properties:
exact
Either a single DOMString which must be the value of the property, or an array of DOMString objects one of which must be the property's value. If the property can't be set to one of the listed values, matching will fail.
ideal
Either a single DOMString or an array of DOMStrings specifying ideal values for the property. If possible, one of the listed values will be used, but if it's not possible, the user agent will use the closest possible match.

Specifications

SpecificationStatusComment
Media Capture and Streams
The definition of 'ConstrainDOMString' in that specification.
Candidate RecommendationInitial definition

Technically, ConstrainDOMString is actually based on an intermediary dictionary named ConstrainDOMStringParameters, which adds exact and ideal to DOMString. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in WebIDL syntax) is ignored here.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:84 次

字数:3655

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文