Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Add Custom Elements to HTML #1343

Merged
merged 22 commits into from
Apr 11, 2018
Merged

Add Custom Elements to HTML #1343

merged 22 commits into from
Apr 11, 2018

Conversation

chaals
Copy link
Collaborator

@chaals chaals commented Apr 7, 2018

This currently adds both autonomous custom elements, which are implemented in Webkit, Blink and Firefox, and customised built-in elements, apparently implemented in both Blink and Firefox.

See #1229, #1277 (This does currently include is=), #1337 (this PR restricts attributes to data-*)

This is pretty much ready for review, but not merge. It probably has linking errors, may have incomplete statements and other text bugs.

I will note the need for examples as a separate issue.

chaals added 11 commits April 4, 2018 11:36
Chapters 2-3 normative stuff from the CE spec. Very WiP
Conversion to bikeshed/linking stuff. Possibly introducing some linking bugs to check when I'm mostly done :S
This file will need another round of this, but leaving it for now.
Notes:

Split autonomous and customized built-in elements a bit

This commit includes is=, despite the resolution of #1277

It also presupposes that #1337 is resolved for the more restrictive approach.
Add global/is to the attributes table
Mark it, and customized built-ins, as under consideration for "at risk"
some editorial cleaning in global attributes section
custom elements could be considered an extensibility mechanism...
Certain to have missed people who deserved to be thanked. :(
split into the general piece and customized - if Firefox hasn't implemented them yet, they will be at risk for the 5.3 version.
</li>

<li>a <dfn id="when-defined-promise-map">when-defined promise map</dfn>, mapping <a>valid custom element names</a>
to promises. It is used to implement the {{whenDefined}} method.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing </p> without opening?

<a href="#custom-element">custom elements</a> are <a>defined</a>. In this example,
we combine it with the <a>:defined</a> pseudo-class to hide a dynamically-loaded article's contents
until all the <a>autonomous custom elements</a> it uses are defined.</p>
<pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to update this to xmp instead of pre

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


<div class="example">
<p>This can occur due to reentrant invocation of this algorithm, as in the following example:</p>
<pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre to xmp so we don't have to escape < and >

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done...

super();
}
}
</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened with an xmp closed with a /pre

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const image = new AutoEmbiggenedImage(15, 20);
console.assert(image.width === 150);
console.assert(image.height === 200);
</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing /pre but no opening

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


In addition, <a>custom element constructors</a> should implement the following good practices:

<li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the opening ul tag here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

(of those introduced by this commit)
<dd>Supplied by the element's author (inherits from {{HTMLElement}})</dd>
</dl>

An <a>autonomous custom element</a>'s' meaning is defined by its author. It <a>represents</a> its children.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s one ' too much.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

a <{tr}> already participates in the <a>table model</a>,
and a <{input/checkbox}> has defined behaviour and participates in form submission.

Since only existing table elements takes part in the <a>table model</a>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: the s at the end of “takes” should not be there.

</li>

<li>
<p>They do not contain any <a>uppercase ASCII letters</a>, so user agent can always treat HTML elements ASCII-case-insensitively.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be either “so the user agent can” or “so user agents can”.


<dt>A list of <dfn>observed attributes</dfn></dt>

<dd>A <code>sequence&lt;DOMString&gt;</code> that is a list of attribute names. When any of the named attributes changes value, the <code>attributeChangedCallback</code> <a>custom element reaction</a> is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure about this: Is the “s” at the end of “changes” in “When any of the named attributes changes value” correct? My feeling is that “any” goes with a plural here, so no “s” for the verb.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for "When any attribute in that list changes value"... since the callback runs once (and in my mind therefore singularly) for each such event.

chaals added 2 commits April 9, 2018 12:50
fixing links, exporting definitions, hopefully fix multipage
@@ -678,6 +679,993 @@
a linear transition of the element's prototype chain, from {{HTMLElement}} to a subclass, instead
of a lateral one, from {{HTMLUnknownElement}} to an unrelated subclass.</p>

<!-- startCEinsert @@ -->
<section>
Copy link
Contributor

@siusin siusin Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the <section> tags outside.

Ronald Eddy jr.,
Ryosuke Niwa,
Sailesh Panchang,
Scottt Miles,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Scottt/Scott

::These are entirely author-defined, extending {{HTMLElement}}
:<a>customized built-in Elements</a>
::These extend elements that are already defined. <span class="note">This is typically to inherit some functionality.</span>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be space after each ':' or '::';

@@ -2035,3 +2035,318 @@
and its flag reset.

</section>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Please remove these <section> tags.

Otherwise looks good to me.

links, typos, ...
@chaals
Copy link
Collaborator Author

chaals commented Apr 11, 2018

except for the example that uses :defined - see #1329 - this is implemented in Firefox and Blink browsers.

@chaals chaals deleted the chaals-ce-bulk-1229 branch April 11, 2018 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants