Skip to content

Commit

Permalink
Meta: set dfn types; switch to (Bikeshed) short syntax
Browse files Browse the repository at this point in the history
This change sets dfn type attributes on a large number of dfn and other
elements throughout the spec — generated using a specialized definitions
parser for the HTML spec built to improve on the existing scraping done
in Shepherd.

This particular patch doesn’t set all the potential dfn types that could
be set; instead it only sets those that were easiest to determine (those
where the data-x attribute and dfn start tag occur on the same line).

The setting of dfn type attributes and “for” attributes is based on the
corresponding WebIDL defined in the spec.

Note that this change also switches the spec to using the Bikeshed short
syntax for the attribute names; specifically:

* rather than using data-dfn-type=element, etc., attribute names, it
  uses attributes literally named "element", etc.

* rather than the attribute name data-dfn-for it uses an attribute
  literally named "for"

* replaces all data-export="" and data-noexport="" attributes with
  value-less attributes literally named "export" and "noexport"

Additionally, the change drops "export" from any dfn that has a dfn type
attribute, and switches data-dfn-type="dfn" disambiguators to "export"
instead. It also cleans up some of the markup in the dependencies
section, which shouldn't be parsed anyway.
  • Loading branch information
sideshowbarker authored and mfreed7 committed Sep 25, 2020
1 parent d692dd6 commit 4e2da5b
Showing 1 changed file with 70 additions and 63 deletions.
133 changes: 70 additions & 63 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2324,8 +2324,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<hr>

<p>The attribute with the name <dfn
data-x-href="https://www.w3.org/TR/xml/#sec-white-space"><code
data-x="attr-xml-space">space</code></dfn> in the <span>XML namespace</span> is defined by
<p>The attribute with the tag name <dfn><code data-x="attr-xml-space">xml:space</code></dfn> in
the <span>XML namespace</span> is defined by <cite>Extensible Markup Language</cite>
<cite>Extensible Markup Language</cite> (<cite>XML</cite>). <ref spec=XML></p>

<p>The <dfn data-x-href="https://www.w3.org/TR/xml/#NT-Name"><code
Expand Down Expand Up @@ -6778,10 +6778,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<h4>Nonce attributes</h4>

<p>A <dfn element-attr for="htmlsvg-global" data-x="attr-nonce"><code>nonce</code></dfn> content
attribute represents a cryptographic nonce ("number used once") which can be used by <cite>Content
Security Policy</cite> to determine whether or not a given fetch will be allowed to proceed. The
value is text. <ref spec="CSP"></p>
data-dfn-for="htmlsvg-global">nonce</dfn> content attribute represents a cryptographic nonce
("number used once") which can be used by <cite>Content Security Policy</cite> to determine
whether or not a given fetch will be allowed to proceed. The value is text. <ref spec="CSP"></p>

<p>Elements that have a <code data-x="attr-nonce">nonce</code> content attribute ensure that the
crytographic nonce is only exposed to script (and not to side-channels like CSS attribute
Expand Down Expand Up @@ -11501,7 +11500,7 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%

<h5>The <code data-x="attr-title">title</code> attribute</h5>

<p>The <dfn element-attr for="html-global"><code data-x="attr-title">title</code></dfn> attribute
<p>The <dfn><code data-x="attr-title">title</code></dfn> attribute <span>represents</span>
<span>represents</span> advisory information for the element, such as would be appropriate for a
tooltip. On a link, this could be the title or a description of the target resource; on an image,
it could be the image credit or a description of the image; on a paragraph, it could be a footnote
Expand Down Expand Up @@ -11573,11 +11572,11 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<h5>The <code data-x="attr-lang">lang</code> and <code data-x="attr-xml-lang">xml:lang</code>
attributes</h5>

<p>The <dfn element-attr for="html-global"><code data-x="attr-lang">lang</code></dfn> attribute
(in no namespace) specifies the primary language for the element's contents and for any of the
element's attributes that contain text. Its value must be a valid BCP 47 language tag, or the
empty string. Setting the attribute to the empty string indicates that the primary language is
unknown<!-- UA conformance requirements for this are below -->. <ref spec=BCP47></p>
<p>The <dfn><code data-x="attr-lang">lang</code></dfn> attribute (in no namespace) specifies the
primary language for the element's contents and for any of the element's attributes that contain
text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to
the empty string indicates that the primary language is unknown<!-- UA conformance requirements
for this are below -->. <ref spec=BCP47></p>

<p>The <dfn data-x="attr-xml-lang" data-x-href="https://www.w3.org/TR/xml/#sec-lang-tag"><code
data-x="">lang</code></dfn> attribute in the <span>XML namespace</span> is defined in XML. <ref
Expand Down Expand Up @@ -11687,10 +11686,10 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<!-- v2: a way to translate the declensions of the word(s), but keep the actual roots the same
for examples, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17954 -->

<p>The <dfn element-attr for="html-global"><code data-x="attr-translate">translate</code></dfn>
attribute is an <span>enumerated attribute</span> that is used to specify whether an element's
attribute values and the values of its <code>Text</code> node children are to be translated when
the page is localized, or whether to leave them unchanged.</p>
<p>The <dfn><code data-x="attr-translate">translate</code></dfn> attribute is an <span>enumerated
attribute</span> that is used to specify whether an element's attribute values and the values of
its <code>Text</code> node children are to be translated when the page is localized, or whether to
leave them unchanged.</p>

<p>The attribute's keywords are the empty string, <code data-x="">yes</code>, and <code
data-x="">no</code>. The empty string and the <code data-x="">yes</code> keyword map to the
Expand Down Expand Up @@ -11791,23 +11790,23 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
with the following keywords and states:</p>

<dl>
<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-ltr">ltr</code></dfn>
<dt>The <dfn><code data-x="attr-dir-ltr">ltr</code></dfn> keyword, which maps to the <dfn data-x="attr-dir-ltr-state">ltr</dfn> state</dt>
keyword, which maps to the <dfn data-x="attr-dir-ltr-state">ltr</dfn> state</dt>

<dd>
<p>Indicates that the contents of the element are explicitly directionally isolated
left-to-right text.</p>
</dd>

<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-rtl">rtl</code></dfn>
<dt>The <dfn><code data-x="attr-dir-rtl">rtl</code></dfn> keyword, which maps to the <dfn data-x="attr-dir-rtl-state">rtl</dfn> state</dt>
keyword, which maps to the <dfn data-x="attr-dir-rtl-state">rtl</dfn> state</dt>

<dd>
<p>Indicates that the contents of the element are explicitly directionally isolated
right-to-left text.</p>
</dd>

<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-auto">auto</code></dfn>
<dt>The <dfn><code data-x="attr-dir-auto">auto</code></dfn> keyword, which maps to the <dfn data-x="attr-dir-auto-state">auto</dfn> state</dt>
keyword, which maps to the <dfn data-x="attr-dir-auto-state">auto</dfn> state</dt>

<dd>
Expand Down Expand Up @@ -12113,8 +12112,8 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP

<div w-nodev>

<p>The <code data-x="dom-style">style</code> IDL attribute is defined in <cite>CSS Object Model</cite>. <ref
spec=CSSOM></p>
<p>The <dfn><code data-x="dom-style">style</code></dfn> IDL attribute is defined in <cite>CSS Object
Model</cite> (<cite>CSSOM</cite>). <ref spec=CSSOM></p>

</div>

Expand Down Expand Up @@ -30570,6 +30569,12 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {

</div>

<p>The <dfn element-attr for="iframe"><code
<p>The <dfn><code data-x="attr-iframe-allowpaymentrequest">allowpaymentrequest</code></dfn>
attribute is a <span>boolean attribute</span>. When specified, it indicates that
<code>Document</code> objects in the <code>iframe</code> element's <span>nested browsing
data-x="concept-document-permissions-policy">permissions policy</span> which allows the "<code
data-x="">payment</code>" feature to be used to make payment requests from any
<p class="note">Neither <code data-x="attr-iframe-allow">allow</code> nor
<code data-x="attr-iframe-allowfullscreen">allowfullscreen</code> can grant access to a feature
in an <code>iframe</code> element's <span>nested browsing context</span> if the element's
Expand Down Expand Up @@ -66160,8 +66165,8 @@ document.body.append(parent);
data-x="">extends</code> option. These types of custom elements have a local name equal to the
value passed in their <code data-x="">extends</code> option, and their <span
data-x="concept-custom-element-definition-name">defined name</span> is used as the value of the
<dfn element-attr for="html-global"><code data-x="attr-is">is</code></dfn> attribute, which
therefore must be a <span>valid custom element name</span>.</p></li>
<dfn><code data-x="attr-is">is</code></dfn> attribute, which therefore must be a <span>valid
custom element name</span>.</p></li>
</ol>

<p>After a <span>custom element</span> is <span data-x="create an element">created</span>,
Expand Down Expand Up @@ -69134,7 +69139,8 @@ Demos:
<h4>Items</h4>

<p>Every <span data-x="HTML elements">HTML element</span> may have an <dfn element-attr
for="html-global"><code data-x="attr-itemscope">itemscope</code></dfn> attribute specified. The
<p>Every <span data-x="HTML elements">HTML element</span> may have an <dfn><code data-x="attr-itemscope">itemscope</code></dfn> attribute specified. The <code
data-x="attr-itemscope">itemscope</code></dfn> attribute specified. The <code
<code data-x="attr-itemscope">itemscope</code> attribute is a <span>boolean attribute</span>.</p>

<p>An element with the <code data-x="attr-itemscope">itemscope</code> attribute specified creates a
Expand All @@ -69143,8 +69149,9 @@ Demos:
<hr>

<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn
<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn><code data-x="attr-itemtype">itemtype</code></dfn> attribute specified, to give the <span>item
element-attr for="html-global"><code data-x="attr-itemtype">itemtype</code></dfn> attribute
specified, to give the <span>item types</span> of the <span data-x="concept-item">item</span>.</p>
types</span> of the <span data-x="concept-item">item</span>.</p>

<p>The <code data-x="attr-itemtype">itemtype</code> attribute, if specified, must have a value that
is an <span>unordered set of unique space-separated tokens</span>, none of which are
Expand Down Expand Up @@ -69195,9 +69202,8 @@ Demos:

<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute and an <code
data-x="attr-itemtype">itemtype</code> attribute that references a vocabulary that is defined to
<dfn>support global identifiers for items</dfn> may also have an <dfn element-attr
for="html-global"><code data-x="attr-itemid">itemid</code></dfn> attribute specified, to give a
global identifier for the <span data-x="concept-item">item</span>, so that it can be related to
<dfn>support global identifiers for items</dfn> may also have an <dfn><code data-x="attr-itemid">itemid</code></dfn> attribute specified, to give a global identifier for
the <span data-x="concept-item">item</span>, so that it can be related to other <span
other <span data-x="concept-item">items</span> on pages elsewhere on the web.</p>

<p>The <code data-x="attr-itemid">itemid</code> attribute, if specified, must have a value that is
Expand Down Expand Up @@ -69225,9 +69231,8 @@ Demos:
<hr>

<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn
element-attr for="html-global"><code data-x="attr-itemref">itemref</code></dfn> attribute
specified, to give a list of additional elements to crawl to find the name-value pairs of the
<span data-x="concept-item">item</span>.</p>
<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn><code data-x="attr-itemref">itemref</code></dfn> attribute specified, to give a list of additional
elements to crawl to find the name-value pairs of the <span data-x="concept-item">item</span>.</p>

<p>The <code data-x="attr-itemref">itemref</code> attribute, if specified, must have a value that
is an <span>unordered set of unique space-separated tokens</span> none of which are
Expand Down Expand Up @@ -72947,9 +72952,9 @@ END:VCARD</pre>

<h4>The <code data-x="attr-tabindex">tabindex</code> attribute</h4>

<p>The <dfn element-attr for="htmlsvg-global"><code data-x="attr-tabindex">tabindex</code></dfn>
content attribute allows authors to make an element and regions that have the element as its
<span>DOM anchor</span> be <span data-x="focusable area">focusable areas</span>, allow or prevent
<p>The <dfn><code data-x="attr-tabindex">tabindex</code></dfn> content attribute allows authors to
make an element and regions that have the element as its <span>DOM anchor</span> be <span
data-x="focusable area">focusable areas</span>, allow or prevent them from being
them from being <span>sequentially focusable</span>, and determine their relative ordering for
<span>sequential focus navigation</span>.</p>

Expand Down Expand Up @@ -73891,10 +73896,11 @@ END:VCARD</pre>
<h4><span id="autofocusing-a-form-control:-the-autofocus-attribute"></span>The <code
data-x="attr-fe-autofocus">autofocus</code> attribute</h4>

<p>The <dfn element-attr for="html-global"><code data-x="attr-fe-autofocus">autofocus</code></dfn>
content attribute allows the author to indicate that an element is to be focused as soon as the
page is loaded or as soon as the <code>dialog</code> within which it finds itself is shown,
allowing the user to just start typing without having to manually focus the main element.</p>
<p>The <dfn element-attr for="button,fieldset,input,object,output,select,textarea"><code
<p>The <dfn><code data-x="attr-fe-autofocus">autofocus</code></dfn> content attribute allows the
author to indicate that an element is to be focused as soon as the page is loaded or as soon as
the <code>dialog</code> within which it finds itself is shown, allowing the user to just start
typing without having to manually focus the main element.</p>

<p>The <code data-x="attr-fe-autofocus">autofocus</code> attribute is a <span>boolean
attribute</span>.</p>
Expand Down Expand Up @@ -74301,8 +74307,8 @@ addShortcutKeyLabel(document.getElementById('c'));</code></pre>
};</code></pre>

<p>The <dfn element-attr for="html-global"><code
data-x="attr-contenteditable">contenteditable</code></dfn> content attribute is an
<span>enumerated attribute</span> whose keywords are the empty string, <code
<p>The <dfn><code data-x="attr-contenteditable">contenteditable</code></dfn> content attribute is an
<span>enumerated attribute</span> whose keywords are the empty string, <code data-x="">true</code>,
data-x="">true</code>, and <code data-x="">false</code>. The empty string and the <code
data-x="">true</code> keyword map to the <i>true</i> state. The <code data-x="">false</code>
keyword maps to the <i>false</i> state. In addition, there is a third state, the <i>inherit</i>
Expand Down Expand Up @@ -74560,13 +74566,13 @@ body { display:none }

</div>

<p>The <dfn element-attr for="html-global"><code data-x="attr-spellcheck">spellcheck</code></dfn>
attribute is an <span>enumerated attribute</span> whose keywords are the empty string, <code
data-x="">true</code> and <code data-x="">false</code>. The empty string and the <code
data-x="">true</code> keyword map to the <i>true</i> state. The <code data-x="">false</code>
keyword maps to the <i>false</i> state. In addition, there is a third state, the <i>default</i>
state, which is the <i data-x="missing value default">missing value default</i> and the <i
data-x="invalid value default">invalid value default</i>.</p>
<p>The <dfn><code data-x="attr-spellcheck">spellcheck</code></dfn> attribute is an <span>enumerated
attribute</span> whose keywords are the empty string, <code data-x="">true</code> and <code
data-x="">false</code>. The empty string and the <code data-x="">true</code> keyword map to the
<i>true</i> state. The <code data-x="">false</code> keyword maps to the <i>false</i> state. In
addition, there is a third state, the <i>default</i> state, which is the <i
data-x="missing value default">missing value default</i> and the <i
default</i>.</p>

<p class="note">The <i>true</i> state indicates that the element is to have its spelling and
grammar checked. The <i>default</i> state indicates that the element is to act according to a
Expand Down Expand Up @@ -74789,12 +74795,12 @@ body { display:none }
</dl>

<p>The <dfn element-attr for="html-global"><code
data-x="attr-autocapitalize">autocapitalize</code></dfn> attribute is an <span>enumerated
attribute</span> whose states are the possible <span data-x="autocapitalization
hint">autocapitalization hints</span>. The <span>autocapitalization hint</span> specified by the
attribute's state combines with other considerations to form the <span>used autocapitalization
hint</span>, which informs the behavior of the user agent. The keywords for this attribute and
their state mappings are as follows:</p>
<p>The <dfn><code data-x="attr-autocapitalize">autocapitalize</code></dfn> attribute is an
<span>enumerated attribute</span> whose states are the possible <span data-x="autocapitalization
data-x="autocapitalization hint">autocapitalization hints</span>. The <span>autocapitalization
hint</span> specified by the attribute's state combines with other considerations to form the
<span>used autocapitalization hint</span>, which informs the behavior of the user agent. The
keywords for this attribute and their state mappings are as follows:</p>

<table>
<thead>
Expand Down Expand Up @@ -74870,13 +74876,13 @@ body { display:none }
</ol>

<p>The <dfn attribute for="HTMLElement"><code
data-x="dom-autocapitalize">autocapitalize</code></dfn> getter steps are to:</p>
<p>The <dfn><code data-x="dom-autocapitalize">autocapitalize</code></dfn> IDL attribute, on

<ol>
<li><p>Let <var>state</var> be the <span>own autocapitalization hint</span> of
getting, must return the string value corresponding to <span>own autocapitalization hint</span> of
<span>this</span>.</p></li>

<li><p>If <var>state</var> is <span data-x="autocap-hint-default">default</span>, then return the
the element, with the exception that the <span data-x="autocap-hint-default">default</span> state
empty string.</p></li>

<li><p>If <var>state</var> is <span data-x="autocap-hint-none">none</span>, then return "<code
Expand All @@ -74889,7 +74895,8 @@ body { display:none }
</ol>

<p>The <code data-x="dom-autocapitalize">autocapitalize</code> setter steps are to set the <code
data-x="attr-autocapitalize">autocapitalize</code> content attribute to the given value.</p>
data-x="attr-autocapitalize">autocapitalize</code> content attribute to the given new value.</p>
content attribute to the given new value.</p>

<hr>

Expand Down Expand Up @@ -74932,8 +74939,8 @@ body { display:none }
controls (such as the value of <code>textarea</code> elements), or in elements in an <span>editing
host</span> (e.g., using <code data-x="attr-contenteditable">contenteditable</code>).</p>

<p>The <dfn element-attr for="html-global"><code data-x="attr-inputmode">inputmode</code></dfn>
content attribute is an <span>enumerated attribute</span> that specifies what kind of input
<p>The <dfn><code data-x="attr-inputmode">inputmode</code></dfn> content attribute is an
<span>enumerated attribute</span> that specifies what kind of input mechanism would be most
mechanism would be most helpful for users entering content.</p>

<table>
Expand Down Expand Up @@ -75019,10 +75026,10 @@ body { display:none }
data-x="attr-contenteditable">contenteditable</code>).</p>

<p>The <dfn element-attr for="html-global"><code
data-x="attr-enterkeyhint">enterkeyhint</code></dfn> content attribute is an <span>enumerated
attribute</span> that specifies what action label (or icon) to present for the enter key on
virtual keyboards. This allows authors to customize the presentation of the enter key in order to
make it more helpful for users.</p>
<p>The <dfn><code data-x="attr-enterkeyhint">enterkeyhint</code></dfn> content attribute is an
<span>enumerated attribute</span> that specifies what action label (or icon) to present for the
enter key on virtual keyboards. This allows authors to customize the presentation of the enter key
in order to make it more helpful for users.</p>

<table>
<thead>
Expand Down

0 comments on commit 4e2da5b

Please sign in to comment.