idl属性在WHATWG html5标准文档中是什么意思?

前端之家收集整理的这篇文章主要介绍了idl属性在WHATWG html5标准文档中是什么意思?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在阅读WHATWG的 HTML5 – A technical specification for Web developers时,我看到许多引用如:

Reflecting content attributes in IDL attributes

Some IDL attributes are defined to reflect a particular content
attribute. This means that on getting,the IDL attribute returns the
current value of the content attribute,and on setting,the IDL
attribute changes the value of the content attribute to the given
value.

和:

In conforming documents,there is only one body element. The
document.body IDL attribute provides scripts with easy access to a
document’s body element.

The body element exposes as event handler content attributes a number
of the event handlers of the Window object. It also mirrors their
event handler IDL attributes.

我的(诚然模糊)的理解来自Windows世界。我认为.idl文件用于映射在n层分布式应用程序中的远程过程调用。我假设一个内容属性引用html元素属性

在标准中没有可以看到的地方,解释了术语“内容属性”和“IDL属性”的这种用法。任何人都可以解释这些术语是什么意思,以及这两种属性如何相关?

解决方法

IDL来自 Web IDL规格:

This document defines an interface definition language,Web IDL,that
can be used to describe interfaces that are intended to be implemented
in web browsers. Web IDL is an IDL variant with a number of features
that allow the behavior of common script objects in the web platform
to be specified more readily. How interfaces described with Web IDL
correspond to constructs within ECMAScript execution environments is
also detailed in this document.

内容属性是出现在标记中的属性

<div id="mydiv" class="example"></div>

在上面的代码中id和class是属性。通常内容属性将具有对应的IDL属性

例如,以下JavaScript:

document.getElementById('mydiv').className = 'example'

相当于设置类的content属性

在JavaScript文本中,IDL属性通常称为属性,因为它们作为DOM对象的属性公开为JavaScript。

虽然通常有一对内容属性和IDL属性/属性,但它们不一定是可互换的。例如,对于< option>元件:

>所选择的内容属性指示选项的初始状态(并且当用户改变选项时不改变)>选择的属性反映控件的当前状态

原文链接:https://www.f2er.com/html5/169476.html

猜你在找的HTML5相关文章