Skip to content

Commit

Permalink
Fix which built-in elements can be customized
Browse files Browse the repository at this point in the history
Fixes #2028. [HTMLConstructor] was introduced in #1404, but <head>,
<marquee>, <frameset>, and <frame> were accidentally left out. At the
same time, this makes <keygen> and <applet> uncustomizable, since we are
trying to remove them from the platform. And in general this adds a few
explanatory paragraphs about what built-in elements can and cannot be
customized.
  • Loading branch information
domenic committed Nov 16, 2016
1 parent e64078e commit 7d6b279
Showing 1 changed file with 46 additions and 22 deletions.
68 changes: 46 additions & 22 deletions source
Expand Up @@ -9336,6 +9336,7 @@ interface <dfn>HTMLElement</dfn> : <span>Element</span> {
<span>HTMLElement</span> implements <span>DocumentAndElementEventHandlers</span>;
<span>HTMLElement</span> implements <span>ElementContentEditable</span>;

// Note: <a href="#customized-built-in-element-restrictions">intentionally</a> not [<span>HTMLConstructor</span>]
interface <dfn>HTMLUnknownElement</dfn> : <span>HTMLElement</span> { };</pre>

<p>The <code>HTMLElement</code> interface holds methods and attributes related to a number of
Expand Down Expand Up @@ -12027,7 +12028,8 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p>
<dd><span>Global attributes</span></dd>
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs-->
<dd>
<pre class="idl">interface <dfn>HTMLHeadElement</dfn> : <span>HTMLElement</span> {};</pre>
<pre class="idl">[<span>HTMLConstructor</span>]
interface <dfn>HTMLHeadElement</dfn> : <span>HTMLElement</span> {};</pre>
</dd>
</dl><!--TOPIC:HTML-->

Expand Down Expand Up @@ -49995,14 +49997,14 @@ Daddy">&lt;/textarea></pre>
<dd><code data-x="attr-fe-name">name</code></dd>
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs-->
<dd>
<pre class="idl">[<span>HTMLConstructor</span>]
<pre class="idl">// Note: <a href="#customized-built-in-element-restrictions">intentionally</a> not [<span>HTMLConstructor</span>]
interface <dfn>HTMLKeygenElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute boolean <span data-x="dom-fe-autofocus">autofocus</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-keygen-challenge">challenge</span>;
[<span>CEReactions</span>] attribute boolean <span data-x="dom-fe-disabled">disabled</span>;
attribute boolean <span data-x="dom-fe-autofocus">autofocus</span>;
attribute DOMString <span data-x="dom-keygen-challenge">challenge</span>;
attribute boolean <span data-x="dom-fe-disabled">disabled</span>;
readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-fae-form">form</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-keygen-keytype">keytype</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-fe-name">name</span>;
attribute DOMString <span data-x="dom-keygen-keytype">keytype</span>;
attribute DOMString <span data-x="dom-fe-name">name</span>;

readonly attribute DOMString <span data-x="dom-keygen-type">type</span>;

Expand Down Expand Up @@ -65796,6 +65798,24 @@ console.log(plasticButton2.getAttribute("is")); // will output "plastic-button"<
data-x="concept-form-submit">form submission</span>, the <code
data-x="attr-fe-disabled">disabled</code> attribute, and so on.</p>

<p id="customized-built-in-element-restrictions"><span data-x="customized built-in
element">Customized built-in elements</span> are designed to allow extension of existing HTML
elements that have useful user-agent supplied behavior or APIs. As such, they can only extend
existing HTML elements defined in this specification, and cannot extend legacy elements such as
<code>bgsound</code>, <code>blink</code>, <code>isindex</code>, <code>multicol</code>,
<code>nextid</code>, or <code>spacer</code> that have been defined to use
<code>HTMLUnknownElement</code> as their <span>element interface</span>.</p>

<p>One reason for this requirement is future-compatibility: if a <span>customized built-in
element</span> was defined that extended a currently-unknown element, for example <code
data-x="">combobox</code>, this would prevent this specification from defining a <code
data-x="">combobox</code> element in the future, as consumers of the derived <span>customized
built-in element</span> would have come to depend on their base element having no interesting
user-agent-supplied behavior.</p>

<p>Additionally, <code>applet</code> and <code>keygen</code> elements cannot be extended, as they
are in the process of being removed from the Web platform.</p>

<h5 id="custom-elements-autonomous-drawbacks">Drawbacks of autonomous custom elements</h5>

<!-- NON-NORMATIVE SECTION -->
Expand Down Expand Up @@ -112586,18 +112606,19 @@ if (s = prompt('What is your name?')) {
<p>The <code>applet</code> element must implement the <code>HTMLAppletElement</code>
interface.</p>

<pre class="idl">interface <dfn>HTMLAppletElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-align">align</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-alt">alt</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-archive">archive</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-code">code</span>;
[<span>CEReactions</span>] attribute USVString <span data-x="dom-applet-codeBase">codeBase</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-height">height</span>;
[<span>CEReactions</span>] attribute unsigned long <span data-x="dom-applet-hspace">hspace</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-name">name</span>;
[<span>CEReactions</span>] attribute USVString _<span data-x="dom-applet-object">object</span>; // the underscore is not part of the identifier <!-- it's a Web IDL escaping mechanism -->
[<span>CEReactions</span>] attribute unsigned long <span data-x="dom-applet-vspace">vspace</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-applet-width">width</span>;
<pre class="idl">// Note: <a href="#customized-built-in-element-restrictions">intentionally</a> not [<span>HTMLConstructor</span>]
interface <dfn>HTMLAppletElement</dfn> : <span>HTMLElement</span> {
attribute DOMString <span data-x="dom-applet-align">align</span>;
attribute DOMString <span data-x="dom-applet-alt">alt</span>;
attribute DOMString <span data-x="dom-applet-archive">archive</span>;
attribute DOMString <span data-x="dom-applet-code">code</span>;
attribute USVString <span data-x="dom-applet-codeBase">codeBase</span>;
attribute DOMString <span data-x="dom-applet-height">height</span>;
attribute unsigned long <span data-x="dom-applet-hspace">hspace</span>;
attribute DOMString <span data-x="dom-applet-name">name</span>;
attribute USVString _<span data-x="dom-applet-object">object</span>; // the underscore is not part of the identifier <!-- it's a Web IDL escaping mechanism -->
attribute unsigned long <span data-x="dom-applet-vspace">vspace</span>;
attribute DOMString <span data-x="dom-applet-width">width</span>;
};</pre>

<p>The <dfn><code data-x="dom-applet-align">align</code></dfn>, <dfn><code
Expand Down Expand Up @@ -112630,7 +112651,8 @@ if (s = prompt('What is your name?')) {
<p>The <code>marquee</code> element must implement the <code>HTMLMarqueeElement</code>
interface.</p>

<pre class="idl">interface <dfn>HTMLMarqueeElement</dfn> : <span>HTMLElement</span> {
<pre class="idl">[<span>HTMLConstructor</span>]
interface <dfn>HTMLMarqueeElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-marquee-behavior">behavior</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-marquee-bgColor">bgColor</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-marquee-direction">direction</span>;
Expand Down Expand Up @@ -112845,7 +112867,8 @@ if (s = prompt('What is your name?')) {
<p>The <code>frameset</code> element must implement the <code>HTMLFrameSetElement</code>
interface.</p>

<pre class="idl">interface <dfn>HTMLFrameSetElement</dfn> : <span>HTMLElement</span> {
<pre class="idl">[<span>HTMLConstructor</span>]
interface <dfn>HTMLFrameSetElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-frameset-cols">cols</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-frameset-rows">rows</span>;
};
Expand Down Expand Up @@ -112965,7 +112988,8 @@ if (s = prompt('What is your name?')) {

<p>The <code>frame</code> element must implement the <code>HTMLFrameElement</code> interface.</p>

<pre class="idl">interface <dfn>HTMLFrameElement</dfn> : <span>HTMLElement</span> {
<pre class="idl">[<span>HTMLConstructor</span>]
interface <dfn>HTMLFrameElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-frame-name">name</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-frame-scrolling">scrolling</span>;
[<span>CEReactions</span>] attribute USVString <span data-x="dom-frame-src">src</span>;
Expand Down

0 comments on commit 7d6b279

Please sign in to comment.