@@ -1249,15 +1249,15 @@ No [=extended attributes=] defined in this specification are applicable to [=inc
1249
1249
1250
1250
</div>
1251
1251
1252
- <div data -fill-with="grammar- CallbackOrInterfaceOrMixin"></div>
1252
+ <div grammar -fill-with="CallbackOrInterfaceOrMixin"></div>
1253
1253
1254
- <div data -fill-with="grammar- CallbackRestOrInterfaceOrMixin"></div>
1254
+ <div grammar -fill-with="CallbackRestOrInterfaceOrMixin"></div>
1255
1255
1256
- <div data -fill-with="grammar- InterfaceOrMixin"></div>
1256
+ <div grammar -fill-with="InterfaceOrMixin"></div>
1257
1257
1258
- <div data -fill-with="grammar- Partial"></div>
1258
+ <div grammar -fill-with="Partial"></div>
1259
1259
1260
- <div data -fill-with="grammar- PartialDefinition"></div>
1260
+ <div grammar -fill-with="PartialDefinition"></div>
1261
1261
1262
1262
<pre class="grammar" id="prod-MixinRest">
1263
1263
MixinRest :
@@ -2449,7 +2449,7 @@ Note: When defining [=method steps=], you implicitly have access to [=this=].
2449
2449
ε
2450
2450
</pre>
2451
2451
2452
- <div data -fill-with="grammar- ArgumentNameKeyword"></div>
2452
+ <div grammar -fill-with="ArgumentNameKeyword"></div>
2453
2453
2454
2454
<h5 id="idl-tojson-operation">toJSON</h5>
2455
2455
@@ -2631,13 +2631,13 @@ See [[#interface-object]] for details on how a [=constructor operation=] is to b
2631
2631
"constructor" "(" ArgumentList ")" ";"
2632
2632
</pre>
2633
2633
2634
- <div data -fill-with="grammar- ArgumentList"></div>
2635
- <div data -fill-with="grammar- Arguments"></div>
2636
- <div data -fill-with="grammar- Argument"></div>
2637
- <div data -fill-with="grammar- ArgumentRest"></div>
2638
- <div data -fill-with="grammar- ArgumentName"></div>
2639
- <div data -fill-with="grammar- Ellipsis"></div>
2640
- <div data -fill-with="grammar- ArgumentNameKeyword"></div>
2634
+ <div grammar -fill-with="ArgumentList"></div>
2635
+ <div grammar -fill-with="Arguments"></div>
2636
+ <div grammar -fill-with="Argument"></div>
2637
+ <div grammar -fill-with="ArgumentRest"></div>
2638
+ <div grammar -fill-with="ArgumentName"></div>
2639
+ <div grammar -fill-with="Ellipsis"></div>
2640
+ <div grammar -fill-with="ArgumentNameKeyword"></div>
2641
2641
2642
2642
2643
2643
<h4 id="idl-stringifiers">Stringifiers</h4>
@@ -4483,9 +4483,9 @@ an [=asynchronously iterable declaration=],
4483
4483
a [=setlike declaration=], or
4484
4484
an [=indexed property getter=].
4485
4485
4486
- <div data -fill-with="grammar- ReadOnlyMember"></div>
4486
+ <div grammar -fill-with="ReadOnlyMember"></div>
4487
4487
4488
- <div data -fill-with="grammar- ReadOnlyMemberRest"></div>
4488
+ <div grammar -fill-with="ReadOnlyMemberRest"></div>
4489
4489
4490
4490
<pre class="grammar" id="prod-ReadWriteMaplike">
4491
4491
ReadWriteMaplike :
@@ -4573,9 +4573,9 @@ an [=asynchronously iterable declaration=],
4573
4573
a [=maplike declaration=], or
4574
4574
an [=indexed property getter=].
4575
4575
4576
- <div data -fill-with="grammar- ReadOnlyMember"></div>
4576
+ <div grammar -fill-with="ReadOnlyMember"></div>
4577
4577
4578
- <div data -fill-with="grammar- ReadOnlyMemberRest"></div>
4578
+ <div grammar -fill-with="ReadOnlyMemberRest"></div>
4579
4579
4580
4580
<pre class="grammar" id="prod-ReadWriteSetlike">
4581
4581
ReadWriteSetlike :
@@ -4640,9 +4640,9 @@ Of the extended attributes defined in this specification, only the [{{CrossOrigi
4640
4640
4641
4641
[=Namespaces=] must be annotated with the [{{Exposed}}] [=extended attribute=].
4642
4642
4643
- <div data -fill-with="grammar- Partial"></div>
4643
+ <div grammar -fill-with="Partial"></div>
4644
4644
4645
- <div data -fill-with="grammar- PartialDefinition"></div>
4645
+ <div grammar -fill-with="PartialDefinition"></div>
4646
4646
4647
4647
<pre class="grammar" id="prod-Namespace">
4648
4648
Namespace :
@@ -4978,9 +4978,9 @@ on that dictionary's [=inherited dictionaries=].
4978
4978
4979
4979
No [=extended attributes=] are applicable to dictionaries.
4980
4980
4981
- <div data -fill-with="grammar- Partial"></div>
4981
+ <div grammar -fill-with="Partial"></div>
4982
4982
4983
- <div data -fill-with="grammar- PartialDefinition"></div>
4983
+ <div grammar -fill-with="PartialDefinition"></div>
4984
4984
4985
4985
<pre class="grammar" id="prod-Dictionary">
4986
4986
Dictionary :
@@ -5015,9 +5015,9 @@ No [=extended attributes=] are applicable to dictionaries.
5015
5015
ε
5016
5016
</pre>
5017
5017
5018
- <div data -fill-with="grammar- DefaultValue"></div>
5018
+ <div grammar -fill-with="DefaultValue"></div>
5019
5019
5020
- <div data -fill-with="grammar- Inheritance"></div>
5020
+ <div grammar -fill-with="Inheritance"></div>
5021
5021
5022
5022
<div class="example" id="example-f7efabfd">
5023
5023
@@ -5474,9 +5474,9 @@ be used as the type of a [=constant=].
5474
5474
The following extended attribute is applicable to callback functions:
5475
5475
[{{LegacyTreatNonObjectAsNull}}].
5476
5476
5477
- <div data -fill-with="grammar- CallbackOrInterfaceOrMixin"></div>
5477
+ <div grammar -fill-with="CallbackOrInterfaceOrMixin"></div>
5478
5478
5479
- <div data -fill-with="grammar- CallbackRestOrInterfaceOrMixin"></div>
5479
+ <div grammar -fill-with="CallbackRestOrInterfaceOrMixin"></div>
5480
5480
5481
5481
<pre class="grammar" id="prod-CallbackRest">
5482
5482
CallbackRest :
@@ -5718,7 +5718,7 @@ are known as <dfn id="dfn-object-type" export>object types</dfn>.
5718
5718
"undefined" Null
5719
5719
</pre>
5720
5720
5721
- <div data -fill-with="grammar- ConstType"></div>
5721
+ <div grammar -fill-with="ConstType"></div>
5722
5722
5723
5723
<pre class="grammar" id="prod-PrimitiveType">
5724
5724
PrimitiveType :
@@ -6384,13 +6384,13 @@ in IDL are represented in the same way that constant values of their
6384
6384
[=member types=] would be
6385
6385
represented.
6386
6386
6387
- <div data -fill-with="grammar- UnionType"></div>
6387
+ <div grammar -fill-with="UnionType"></div>
6388
6388
6389
- <div data -fill-with="grammar- UnionMemberType"></div>
6389
+ <div grammar -fill-with="UnionMemberType"></div>
6390
6390
6391
- <div data -fill-with="grammar- UnionMemberTypes"></div>
6391
+ <div grammar -fill-with="UnionMemberTypes"></div>
6392
6392
6393
- <div data -fill-with="grammar- DistinguishableType"></div>
6393
+ <div grammar -fill-with="DistinguishableType"></div>
6394
6394
6395
6395
6396
6396
<h4 id="idl-annotated-types">Annotated types</h4>
@@ -14925,7 +14925,7 @@ in the input text being parsed. Such <emu-t class="regex"><a href="#prod-whites
14925
14925
The following LL(1) grammar, starting with <emu-nt><a href="#prod-Definitions">Definitions</a></emu-nt>,
14926
14926
matches an [=IDL fragment=]:
14927
14927
14928
- <div data -fill-with="grammar- index"></div>
14928
+ <div grammar -fill-with="index"></div>
14929
14929
14930
14930
Note: The <emu-nt><a href="#prod-Other">Other</a></emu-nt>
14931
14931
non-terminal matches any single terminal symbol except for
@@ -15053,33 +15053,51 @@ which is available under the
15053
15053
<a href=https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document>W3C Software and Document License</a>.
15054
15054
15055
15055
15056
- <script class="remove">
15057
- // Grammar
15058
- (function() {
15059
- function wrap(s) { return "<pre class=grammar>" + s + "</pre>"; }
15060
- var output = "";
15061
- [].forEach.call(document.querySelectorAll("pre.grammar"), pre => {
15062
- var html = pre.textContent.replace(/("[^"]+")|([a-zA-Z]+)|(:)/g, m => {
15063
- if (/^"/.test(m)) { return "<emu-t>" + m.replace(/^"|"$/g, "") + "</emu-t>"; }
15064
- if (/^(integer|decimal|identifier|string|whitespace|comment|other)$/.test(m)) {
15065
- return "<emu-t class=\"regex\"><a href=\"#prod-" + m + "\">" + m + "</a></emu-t>";
15066
- }
15067
- if (m == ":") { return "::"; }
15068
- if (document.querySelector("#prod-" + m)) {
15069
- return "<emu-nt><a href=\"#prod-" + m + "\">" + m + "</a></emu-nt>";
15070
- }
15071
- return "<emu-nt>" + m + "</emu-nt>"
15072
- });
15073
-
15074
- pre.innerHTML = html;
15075
- var fillWith = document.querySelectorAll("div[data-fill-with=\"grammar-" + pre.id.replace("prod-", "") + "\"]");
15076
- [].forEach.call(fillWith, div => div.innerHTML = wrap(html));
15077
-
15078
- if (!(/\bno-index\b/).test(pre.className)) {
15079
- output += html.replace(/<emu-nt>/, "<emu-nt id=\"" + pre.id.replace("prod-", "index-prod-") + "\">")
15080
- .replace(/#prod-([^a-z])/g, "#index-prod-$1") + "\n";
15081
- }
15082
- });
15083
- document.querySelector("div[data-fill-with=\"grammar-index\"]").innerHTML = wrap(output);
15084
- })();
15056
+ <script type="module" class="remove">
15057
+ // This is a copy of the script from webidl-grammar-post-processor. It will fill in the various
15058
+ // `grammar-fill-with=""` parts of the document at runtime, allowing local development to just use
15059
+ // `bikeshed` instead of the whole `make` process. In fully-built versions, it is removed by
15060
+ // webidl-grammar-post-processor.
15061
+
15062
+ let output = "";
15063
+ for (const pre of document.querySelectorAll("pre.grammar")) {
15064
+ const html = pre.textContent.replace(/("[^"]+")|([a-zA-Z]+)|(:)/g, m => {
15065
+ if (/^"/.test(m)) {
15066
+ return `<emu-t>${m.replace(/^"|"$/g, "")}</emu-t>`;
15067
+ }
15068
+ if (/^(integer|decimal|identifier|string|whitespace|comment|other)$/.test(m)) {
15069
+ return `<emu-t class="regex"><a href="#prod-${m}">${m}</a></emu-t>`;
15070
+ }
15071
+ if (m == ":") {
15072
+ return "::";
15073
+ }
15074
+ if (document.querySelector(`#prod-${m}`)) {
15075
+ return `<emu-nt><a href="#prod-${m}">${m}</a></emu-nt>`;
15076
+ }
15077
+ return `<emu-nt>${m}</emu-nt>`;
15078
+ });
15079
+
15080
+ pre.innerHTML = html;
15081
+
15082
+ const fillWith = document.querySelectorAll(`div[grammar-fill-with="${pre.id.replace("prod-", "")}"]`);
15083
+ for (const div of fillWith) {
15084
+ div.innerHTML = wrap(html);
15085
+ }
15086
+
15087
+ if (!pre.classList.contains("no-index")) {
15088
+ output += html
15089
+ .replace(/<emu-nt>/, `<emu-nt id="${pre.id.replace("prod-", "index-prod-")}">`)
15090
+ .replace(/#prod-([^a-z])/g, "#index-prod-$1") + "\n";
15091
+ }
15092
+ }
15093
+
15094
+ document.querySelector("div[grammar-fill-with=\"index\"]").innerHTML = wrap(output);
15095
+
15096
+ for (const el of document.querySelectorAll("[grammar-fill-with]")) {
15097
+ el.removeAttribute("grammar-fill-with");
15098
+ }
15099
+
15100
+ function wrap(s) {
15101
+ return `<pre class=grammar>${s}</pre>`;
15102
+ }
15085
15103
</script>
0 commit comments