Skip to content

Commit 4e2da5b

Browse files
sideshowbarkermfreed7
authored andcommitted
Meta: set dfn types; switch to (Bikeshed) short syntax
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.
1 parent d692dd6 commit 4e2da5b

File tree

1 file changed

+70
-63
lines changed

1 file changed

+70
-63
lines changed

source

Lines changed: 70 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,8 +2324,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
23242324
<hr>
23252325

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

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

67796779
<h4>Nonce attributes</h4>
67806780

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

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

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

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

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

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

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

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

1179311792
<dl>
11794-
<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-ltr">ltr</code></dfn>
11793+
<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>
1179511794
keyword, which maps to the <dfn data-x="attr-dir-ltr-state">ltr</dfn> state</dt>
1179611795

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

11802-
<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-rtl">rtl</code></dfn>
11801+
<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>
1180311802
keyword, which maps to the <dfn data-x="attr-dir-rtl-state">rtl</dfn> state</dt>
1180411803

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

11810-
<dt>The <dfn attr-value for="html-global/dir"><code data-x="attr-dir-auto">auto</code></dfn>
11809+
<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>
1181111810
keyword, which maps to the <dfn data-x="attr-dir-auto-state">auto</dfn> state</dt>
1181211811

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

1211412113
<div w-nodev>
1211512114

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

1211912118
</div>
1212012119

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

3057130570
</div>
3057230571

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

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

6913669141
<p>Every <span data-x="HTML elements">HTML element</span> may have an <dfn element-attr
69137-
for="html-global"><code data-x="attr-itemscope">itemscope</code></dfn> attribute specified. The
69142+
<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
69143+
data-x="attr-itemscope">itemscope</code></dfn> attribute specified. The <code
6913869144
<code data-x="attr-itemscope">itemscope</code> attribute is a <span>boolean attribute</span>.</p>
6913969145

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

6914569151
<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn
69152+
<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
6914669153
element-attr for="html-global"><code data-x="attr-itemtype">itemtype</code></dfn> attribute
69147-
specified, to give the <span>item types</span> of the <span data-x="concept-item">item</span>.</p>
69154+
types</span> of the <span data-x="concept-item">item</span>.</p>
6914869155

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

6919669203
<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute and an <code
6919769204
data-x="attr-itemtype">itemtype</code> attribute that references a vocabulary that is defined to
69198-
<dfn>support global identifiers for items</dfn> may also have an <dfn element-attr
69199-
for="html-global"><code data-x="attr-itemid">itemid</code></dfn> attribute specified, to give a
69200-
global identifier for the <span data-x="concept-item">item</span>, so that it can be related to
69205+
<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
69206+
the <span data-x="concept-item">item</span>, so that it can be related to other <span
6920169207
other <span data-x="concept-item">items</span> on pages elsewhere on the web.</p>
6920269208

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

6922769233
<p>Elements with an <code data-x="attr-itemscope">itemscope</code> attribute may have an <dfn
69228-
element-attr for="html-global"><code data-x="attr-itemref">itemref</code></dfn> attribute
69229-
specified, to give a list of additional elements to crawl to find the name-value pairs of the
69230-
<span data-x="concept-item">item</span>.</p>
69234+
<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
69235+
elements to crawl to find the name-value pairs of the <span data-x="concept-item">item</span>.</p>
6923169236

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

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

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

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

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

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

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

7456174567
</div>
7456274568

74563-
<p>The <dfn element-attr for="html-global"><code data-x="attr-spellcheck">spellcheck</code></dfn>
74564-
attribute is an <span>enumerated attribute</span> whose keywords are the empty string, <code
74565-
data-x="">true</code> and <code data-x="">false</code>. The empty string and the <code
74566-
data-x="">true</code> keyword map to the <i>true</i> state. The <code data-x="">false</code>
74567-
keyword maps to the <i>false</i> state. In addition, there is a third state, the <i>default</i>
74568-
state, which is the <i data-x="missing value default">missing value default</i> and the <i
74569-
data-x="invalid value default">invalid value default</i>.</p>
74569+
<p>The <dfn><code data-x="attr-spellcheck">spellcheck</code></dfn> attribute is an <span>enumerated
74570+
attribute</span> whose keywords are the empty string, <code data-x="">true</code> and <code
74571+
data-x="">false</code>. The empty string and the <code data-x="">true</code> keyword map to the
74572+
<i>true</i> state. The <code data-x="">false</code> keyword maps to the <i>false</i> state. In
74573+
addition, there is a third state, the <i>default</i> state, which is the <i
74574+
data-x="missing value default">missing value default</i> and the <i
74575+
default</i>.</p>
7457074576

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

7479174797
<p>The <dfn element-attr for="html-global"><code
74792-
data-x="attr-autocapitalize">autocapitalize</code></dfn> attribute is an <span>enumerated
74793-
attribute</span> whose states are the possible <span data-x="autocapitalization
74794-
hint">autocapitalization hints</span>. The <span>autocapitalization hint</span> specified by the
74795-
attribute's state combines with other considerations to form the <span>used autocapitalization
74796-
hint</span>, which informs the behavior of the user agent. The keywords for this attribute and
74797-
their state mappings are as follows:</p>
74798+
<p>The <dfn><code data-x="attr-autocapitalize">autocapitalize</code></dfn> attribute is an
74799+
<span>enumerated attribute</span> whose states are the possible <span data-x="autocapitalization
74800+
data-x="autocapitalization hint">autocapitalization hints</span>. The <span>autocapitalization
74801+
hint</span> specified by the attribute's state combines with other considerations to form the
74802+
<span>used autocapitalization hint</span>, which informs the behavior of the user agent. The
74803+
keywords for this attribute and their state mappings are as follows:</p>
7479874804

7479974805
<table>
7480074806
<thead>
@@ -74870,13 +74876,13 @@ body { display:none }
7487074876
</ol>
7487174877

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

7487574881
<ol>
74876-
<li><p>Let <var>state</var> be the <span>own autocapitalization hint</span> of
74882+
getting, must return the string value corresponding to <span>own autocapitalization hint</span> of
7487774883
<span>this</span>.</p></li>
7487874884

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

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

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

7489474901
<hr>
7489574902

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

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

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

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

7502775034
<table>
7502875035
<thead>

0 commit comments

Comments
 (0)