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属性”的这种用法。任何人都可以解释这些术语是什么意思,以及这两种属性如何相关?
解决方法
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。