Skip to content

Commit

Permalink
Use partial definitions for monkey-patched Web IDL (#21)
Browse files Browse the repository at this point in the history
The `partial` Web IDL keyword allows to extend the base `HTMLIFrameElement` and
`Window` interfaces properly, without creating duplicate definitions.
  • Loading branch information
tidoust authored Dec 3, 2023
1 parent f0166a1 commit 4037421
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -576,35 +576,25 @@ It is exposed to the Javascript [=HTMLIFrameElement=] interface:

<div class="monkey-patch">
<pre class="idl" highlight="idl">
[Exposed=Window]
interface <a>HTMLIFrameElement</a> : <a>HTMLElement</a> {
// [...]
attribute boolean <a lt="dom-iframe-credentialless">credentialless</a>;
// [...]
partial interface HTMLIFrameElement {
attribute boolean credentialless;
};
</pre>

<p>The IDL attributes <dfn export lt="dom-iframe-credentialless">credentialless</dfn>,
<p>The IDL attributes <dfn attribute for="HTMLIFrameElement">credentialless</dfn>,
must <a>reflect</a> the respective content attributes of the same name.</p>

</div>

### The Window attribute ### {#spec-window-attribute}

Add a read-only constant {{Window/credentialless}} attribute
Add a read-only constant <dfn attribute for="Window">credentialless</dfn> attribute
to the [=Window=] object.

<div class="monkey-patch">
<pre class="idl" highlight="idl">
[
Global=<a>Window</a>,
Exposed=<a>Window</a>,
<a>LegacyUnenumerableNamedProperties</a>
]
interface <a>Window</a> : <a>EventTarget</a> {
// ...
readonly attribute boolean <a>credentialless</a>;
// ...
partial interface Window {
readonly attribute boolean credentialless;
};
</pre>
</div>
Expand Down

0 comments on commit 4037421

Please sign in to comment.