Skip to content

Commit e86c455

Browse files
authored
Replace spec table by macro in API Overview Pages (a to b) (mdn#6149)
1 parent e0c2266 commit e86c455

File tree

7 files changed

+16
-111
lines changed

7 files changed

+16
-111
lines changed

files/en-us/web/api/background_fetch_api/index.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,7 @@ <h2 id="Examples">Examples</h2>
6565

6666
<h2 id="Specifications">Specifications</h2>
6767

68-
<table class="standard-table">
69-
<tbody>
70-
<tr>
71-
<th scope="col">Specification</th>
72-
<th scope="col">Status</th>
73-
<th scope="col">Comment</th>
74-
</tr>
75-
<tr>
76-
<td>{{SpecName('Background Fetch')}}</td>
77-
<td>{{Spec2('Background Fetch')}}</td>
78-
<td>Initial definition.</td>
79-
</tr>
80-
</tbody>
81-
</table>
68+
{{Specifications("api.BackgroundFetchManager")}}
8269

8370
<h2 id="See_also">See also</h2>
8471

files/en-us/web/api/background_tasks_api/index.html

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ <h3 id="Falling_back_to_setTimeout">Falling back to setTimeout</h3>
4343
<pre class="brush: js">window.requestIdleCallback = window.requestIdleCallback || function(handler) {
4444
let startTime = Date.now();
4545

46-
  return setTimeout(function() {
46+
return setTimeout(function() {
4747
handler({
4848
didTimeout: false,
49-
      timeRemaining: function() {
49+
timeRemaining: function() {
5050
return Math.max(0, 50.0 - (Date.now() - startTime));
51-
      }
52-
    });
53-
  }, 1);
51+
}
52+
});
53+
}, 1);
5454
}</pre>
5555

5656
<p>If {{domxref("Window.requestIdleCallback", "window.requestIdleCallback")}} is undefined, we create it here. The function begins by recording the time at which our implementation was called. We'll be using that to compute the value returned by our shim for {{domxref("IdleDeadline.timeRemaining()", "timeRemaining()")}}.</p>
5757

58-
<p>Then we call {{domxref("WindowOrWorkerGlobalScope/setTimeout", "setTimeout()")}}, passing into it a function which runs the callback passed into our implementation of <code>requestIdleCallback()</code>. The callback is passed an object which conforms to {{domxref("IdleDeadline")}}, with {{domxref("IdleDeadline.didTimeout", "didTimeout")}} set to <code>false</code> and a {{domxref("IdleDeadline.timeRemaining", "timeRemaining()")}} method which is implemented to give the callback 50 milliseconds of time to begin with. Each time <code>timeRemaining()</code> is called, it subtracts the elapsed time from the original 50 milliseconds to determine the amount of time left.</p>
58+
<p>Then we call {{domxref("WindowOrWorkerGlobalScope/setTimeout", "setTimeout()")}}, passing into it a function which runs the callback passed into our implementation of <code>requestIdleCallback()</code>. The callback is passed an object which conforms to {{domxref("IdleDeadline")}}, with {{domxref("IdleDeadline.didTimeout", "didTimeout")}} set to <code>false</code> and a {{domxref("IdleDeadline.timeRemaining", "timeRemaining()")}} method which is implemented to give the callback 50 milliseconds of time to begin with. Each time <code>timeRemaining()</code> is called, it subtracts the elapsed time from the original 50 milliseconds to determine the amount of time left.</p>
5959

6060
<p>As a result, while our shim doesn't constrain itself to the amount of idle time left in the current event loop pass like the true <code>requestIdleCallback()</code>, it does at least limit the callback to no more than 50 milliseconds of run time per pass.</p>
6161

@@ -65,7 +65,7 @@ <h3 id="Falling_back_to_setTimeout">Falling back to setTimeout</h3>
6565
clearTimeout(id);
6666
}</pre>
6767

68-
<p>If <code>cancelIdleCallback()</code> isn't defined, this creates one which passes the specified callback ID through to {{domxref("WindowOrWorkerGlobalScope/clearTimeout", "clearTimeout()")}}.</p>
68+
<p>If <code>cancelIdleCallback()</code> isn't defined, this creates one which passes the specified callback ID through to {{domxref("WindowOrWorkerGlobalScope/clearTimeout", "clearTimeout()")}}.</p>
6969

7070
<p>Now your code will work even on browsers that don't support the Background Tasks API, albeit not as efficiently.</p>
7171

@@ -237,7 +237,7 @@ <h4 id="Variable_declarations">Variable declarations</h4>
237237
<p>Finally, we set up a couple of variables for other items:</p>
238238

239239
<ul>
240-
<li><code>logFragment</code> will be used to store a {{domxref("DocumentFragment")}} that's generated by our logging functions to create content to append to the log when the next animation frame is rendered.</li>
240+
<li><code>logFragment</code> will be used to store a {{domxref("DocumentFragment")}} that's generated by our logging functions to create content to append to the log when the next animation frame is rendered.</li>
241241
<li><code>statusRefreshScheduled</code> is used to track whether or not we've already scheduled an update of the status display box for the upcoming frame, so that we only do it once per frame</li>
242242
</ul>
243243

@@ -485,24 +485,11 @@ <h3 id="Result">Result</h3>
485485

486486
<h2 id="Specifications">Specifications</h2>
487487

488-
<table class="standard-table">
489-
<tbody>
490-
<tr>
491-
<th scope="col">Specification</th>
492-
<th scope="col">Status</th>
493-
<th scope="col">Comment</th>
494-
</tr>
495-
<tr>
496-
<td>{{SpecName("Background Tasks")}}</td>
497-
<td>{{Spec2("Background Tasks")}}</td>
498-
<td></td>
499-
</tr>
500-
</tbody>
501-
</table>
488+
{{Specifications("api.Window.requestIdleCallback")}}
502489

503490
<h2 id="Browser_compatibility">Browser compatibility</h2>
504491

505-
<p>{{Compat("api.Window.requestIdleCallback")}}</p>
492+
<p>{{Compat("api.IdleDeadline")}}</p>
506493

507494
<h2 id="See_also">See also</h2>
508495

files/en-us/web/api/badging_api/index.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,7 @@ <h2 id="Examples">Examples</h2>
9494

9595
<h2 id="Specifications">Specifications</h2>
9696

97-
<table class="standard-table">
98-
<tbody>
99-
<tr>
100-
<th scope="col">Specification</th>
101-
<th scope="col">Status</th>
102-
<th scope="col">Comment</th>
103-
</tr>
104-
<tr>
105-
<td>{{SpecName('Badging API','','')}}</td>
106-
<td>{{Spec2('Badging API')}}</td>
107-
<td>Initial definition.</td>
108-
</tr>
109-
</tbody>
110-
</table>
97+
{{Specifications("api.Navigator.setAppBadge")}}
11198

11299
<h2 id="See_also">See also</h2>
113100

files/en-us/web/api/barcode_detection_api/index.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,7 @@ <h3 id="Detect_Barcodes">Detect Barcodes</h3>
156156

157157
<h2 id="Specifications">Specifications</h2>
158158

159-
<table class="standard-table">
160-
<tbody>
161-
<tr>
162-
<th scope="col">Specification</th>
163-
<th scope="col">Status</th>
164-
<th scope="col">Comment</th>
165-
</tr>
166-
<tr>
167-
<td>{{SpecName("Shape Detection API")}}</td>
168-
<td>{{Spec2("Shape Detection API")}}</td>
169-
<td>Initial definition.</td>
170-
</tr>
171-
</tbody>
172-
</table>
159+
{{Specifications("api.BarcodeDetector")}}
173160

174161
<h2 id="Browser_compatibility">Browser compatibility</h2>
175162

files/en-us/web/api/battery_status_api/index.html

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,7 @@ <h2 id="Example">Example</h2>
7474

7575
<h2 id="Specifications">Specifications</h2>
7676

77-
<table class="standard-table">
78-
<thead>
79-
<tr>
80-
<th scope="col">Specification</th>
81-
<th scope="col">Status</th>
82-
<th scope="col">Comment</th>
83-
</tr>
84-
</thead>
85-
<tbody>
86-
<tr>
87-
<td>{{SpecName("Battery API")}}</td>
88-
<td>{{Spec2("Battery API")}}</td>
89-
<td>Initial definition.</td>
90-
</tr>
91-
</tbody>
92-
</table>
77+
{{Specifications("api.BatteryManager")}}
9378

9479
<h2 id="Browser_compatibility">Browser compatibility</h2>
9580

files/en-us/web/api/beacon_api/index.html

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,7 @@ <h2>Interfaces</h2>
2626

2727
<h2 id="Specifications">Specifications</h2>
2828

29-
<table class="standard-table">
30-
<thead>
31-
<tr>
32-
<th scope="col">Specification</th>
33-
<th scope="col">Status</th>
34-
<th scope="col">Comment</th>
35-
</tr>
36-
</thead>
37-
<tbody>
38-
<tr>
39-
<td>{{SpecName('Beacon')}}</td>
40-
<td>{{Spec2('Beacon')}}</td>
41-
<td>Initial definition</td>
42-
</tr>
43-
</tbody>
44-
</table>
29+
{{Specifications("api.Navigator.sendBeacon")}}
4530

4631
<h2 id="Browser_compatibility">Browser compatibility</h2>
4732

files/en-us/web/api/broadcast_channel_api/index.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,7 @@ <h2 id="Conclusion">Conclusion</h2>
6464

6565
<h2 id="Specifications">Specifications</h2>
6666

67-
<table class="standard-table">
68-
<tbody>
69-
<tr>
70-
<th scope="col">Specification</th>
71-
<th scope="col">Status</th>
72-
<th scope="col">Comment</th>
73-
</tr>
74-
<tr>
75-
<td>{{SpecName('HTML WHATWG', "comms.html#broadcasting-to-other-browsing-contexts", "The Broadcast Channel API")}}</td>
76-
<td>{{Spec2('HTML WHATWG')}}</td>
77-
<td>Initial definition.</td>
78-
</tr>
79-
</tbody>
80-
</table>
67+
{{Specifications("api.BroadcastChannel")}}
8168

8269
<h2 id="Browser_compatibility">Browser compatibility</h2>
8370

0 commit comments

Comments
 (0)