Skip to content

Commit 0ad1eae

Browse files
[WebIDL] スタイル編集
IDL 用のスタイルを他の仕様と共通化
1 parent bcce5af commit 0ad1eae

2 files changed

Lines changed: 151 additions & 180 deletions

File tree

WebIDL-JS-ja.html

Lines changed: 37 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,20 @@
66

77
<style>
88

9-
:root {
10-
--code-color: light-dark( hsl(12 100% 33%), hsl(12 100% 73%) );
11-
--idl-color: light-dark( hsl(231 100% 23%), hsl(231 100% 83%) );
12-
--idl-bg-color: light-dark( hsl(204 80% 95%), hsl(204 80% 13%) );
13-
}
14-
15-
code {
16-
color: var(--code-color);
17-
}
18-
199
/* 拡張d属性 */
2010
.xattr {
2111
font-family: monospace0, monospace;
2212
color: var(--text-color-1);
2313
}
2414

25-
/* IDL, JavaScript 型/値 */
15+
/* IDL */
2616

2717
.idltype,
2818
.idlmember,
2919
.idlvalue {
30-
font-family: monospace0, monospace;
31-
color: var(--idl-color);
3220
}
3321

34-
/* JavaScript */
22+
/* JS */
3523
.js-property,
3624
.js-error {
3725
color: var(--js-color);
@@ -42,16 +30,6 @@
4230
text-decoration: underline;
4331
}
4432

45-
/* コードブロック */
46-
pre {
47-
margin: 0.5em 0 0.5em 0.5em;
48-
padding: 0.5em 1em;
49-
}
50-
51-
pre.webidl {
52-
background: var(--idl-bg-color);
53-
}
54-
5533
/* 引用例 */
5634
blockquote {
5735
border: dashed thin var(--N-color);
@@ -4132,7 +4110,7 @@ <h5 title="Creating a sequence from an iterable">3.2.21.1. 可反復から連列
41324110
The following interface defines an attribute of a sequence type as well as an operation with an argument of a sequence type.
41334111
</p>
41344112

4135-
<pre class="webidl">
4113+
<pre class="idl">
41364114
[Exposed=Window]
41374115
interface Canvas {
41384116

@@ -5829,7 +5807,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
58295807
delay is an operation that returns a promise that will be fulfilled in a number of milliseconds. It illustrates how simply you can resolve a promise, with one line of prose.
58305808
</p>
58315809

5832-
<pre class="webidl">
5810+
<pre class="idl">
58335811
interface I {
58345812
Promise&lt;undefined&gt; delay(unrestricted double ms);
58355813
};
@@ -5914,7 +5892,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
59145892
The validatedDelay operation is much like the delay function, except it will validate its arguments. This shows how to use rejected promises to signal immediate failure before even starting any asynchronous operations.
59155893
</p>
59165894

5917-
<pre class="webidl">
5895+
<pre class="idl">
59185896
interface I {
59195897
Promise&lt;undefined&gt; validatedDelay(unrestricted double ms);
59205898
};
@@ -6006,7 +5984,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
60065984
addDelay is an operation that adds an extra number of milliseconds of delay between promise settling and the returned promise settling.
60075985
</p>
60085986

6009-
<pre class="webidl">
5987+
<pre class="idl">
60105988
interface I {
60115989
Promise&lt;any&gt; addDelay(Promise&lt;any&gt; promise, unrestricted double ms);
60125990
};
@@ -6148,7 +6126,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
61486126
environment.ready is an attribute that signals when some part of some environment, e.g. a DOM document, becomes "ready". It illustrates how to encode environmental asynchronicity.
61496127
</p>
61506128

6151-
<pre class="webidl">
6129+
<pre class="idl">
61526130
interface Environment {
61536131
readonly attribute Promise&lt;undefined&gt; ready;
61546132
};
@@ -6270,7 +6248,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
62706248
addBookmark is an operation that requests that the user add the current web page as a bookmark. It’s drawn from some iterative design work and illustrates a more real-world scenario of appealing to environmental asynchrony, as well as immediate rejections.
62716249
</p>
62726250

6273-
<pre class="webidl">
6251+
<pre class="idl">
62746252
interface I {
62756253
Promise&lt;undefined&gt; addBookmark();
62766254
};
@@ -6394,7 +6372,7 @@ <h5 title="Examples">3.2.24.2. 例</h5>
63946372
Several places in [SERVICE-WORKERS] use get a promise to wait for all. batchRequest illustrates a simplified version of one of their uses. It takes as input a sequence of URLs, and returns a promise for a sequence of Response objects created by fetching the corresponding URL. If any of the fetches fail, it will return a promise rejected with that failure.
63956373
</p>
63966374

6397-
<pre class="webidl">
6375+
<pre class="idl">
63986376
interface I {
63996377
Promise&lt;sequence&lt;Response&gt;&gt; batchRequest(sequence&lt;USVString&gt; urls);
64006378
};
@@ -8158,7 +8136,7 @@ <h4>3.3.2. `AllowShared^x</h4>
81588136
The following IDL fragment demonstrates the possible combinations of the [AllowResizable] and [AllowShared] extended attribute:
81598137
</p>
81608138

8161-
<pre class="webidl">
8139+
<pre class="idl">
81628140
[Exposed=Window]
81638141
interface ExampleBufferFeature {
81648142
undefined writeInto(ArrayBufferView %dest);
@@ -8275,7 +8253,7 @@ <h4>3.3.3. `Clamp^x</h4>
82758253
In the following IDL fragment, two operations are declared that take three octet arguments; one uses the [Clamp] extended attribute on all three arguments, while the other does not:
82768254
</p>
82778255

8278-
<pre class="webidl">
8256+
<pre class="idl">
82798257
[Exposed=Window]
82808258
interface GraphicsContext {
82818259
undefined setColor(octet %red, octet %green, octet %blue);
@@ -8548,7 +8526,7 @@ <h4>3.3.5. `Default^x</h4>
85488526
As an example, the [Default] extended attribute is suitable for use on toJSON regular operations:
85498527
</p>
85508528

8551-
<pre class="webidl">
8529+
<pre class="idl">
85528530
[Exposed=Window]
85538531
interface Animal {
85548532
attribute DOMString name;
@@ -8684,7 +8662,7 @@ <h4>3.3.6. `EnforceRange^x</h4>
86848662
In the following IDL fragment, two operations are declared that take three octet arguments; one uses the [EnforceRange] extended attribute on all three arguments, while the other does not:
86858663
</p>
86868664

8687-
<pre class="webidl">
8665+
<pre class="idl">
86888666
[Exposed=Window]
86898667
interface GraphicsContext {
86908668
undefined setColor(octet %red, octet %green, octet %blue);
@@ -9400,7 +9378,7 @@ <h4>3.3.7. `Exposed^x</h4>
94009378
The following IDL fragment shows how that might be achieved:
94019379
</p>
94029380

9403-
<pre class="webidl">
9381+
<pre class="idl">
94049382
[Exposed=Window, Global=Window]
94059383
interface Window {
94069384
/* ... */
@@ -9748,7 +9726,7 @@ <h4>3.3.8. `Global^x</h4>
97489726
The Window interface exposes frames as properties on the Window object. Since the Window object also serves as the JavaScript global object, variable declarations or assignments to the named properties will result in them being replaced by the new value. Variable declarations for attributes will not create a property that replaces the existing one.
97499727
</p>
97509728

9751-
<pre class="webidl">
9729+
<pre class="idl">
97529730
[Exposed=Window, Global=Window]
97539731
interface Window {
97549732
getter object【!any】 (DOMString %name);
@@ -9886,7 +9864,7 @@ <h4>3.3.9. `NewObject^x</h4>
98869864
As an example, this extended attribute is suitable for use on the createElement() operation on the Document interface, since a new object is always returned when it is called. [DOM]
98879865
</p>
98889866

9889-
<pre class="webidl">
9867+
<pre class="idl">
98909868
[Exposed=Window]
98919869
interface Document : Node {
98929870
[NewObject] Element createElement(DOMString %localName);
@@ -10022,7 +10000,7 @@ <h4>3.3.10. `PutForwards^x</h4>
1002210000
The following IDL fragment defines interfaces for names and people. The [PutForwards] extended attribute is used on the name attribute of the Person interface to indicate that assignments to that attribute result in assignments to the full attribute of the Person object:
1002310001
</p>
1002410002

10025-
<pre class="webidl">
10003+
<pre class="idl">
1002610004
[Exposed=Window]
1002710005
interface Name {
1002810006
attribute DOMString full;
@@ -10135,7 +10113,7 @@ <h4>3.3.11. `Replaceable^x</h4>
1013510113
The following IDL fragment defines an interface with an operation that increments a counter, and an attribute that exposes the counter’s value, which is initially 0:
1013610114
</p>
1013710115

10138-
<pre class="webidl">
10116+
<pre class="idl">
1013910117
[Exposed=Window]
1014010118
interface Counter {
1014110119
[Replaceable] readonly attribute unsigned long value;
@@ -10251,7 +10229,7 @@ <h4>3.3.12. `SameObject^x</h4>
1025110229
As an example, this extended attribute is suitable for use on the implementation attribute on the Document interface since the same object is always returned for a given Document object. [DOM]
1025210230
</p>
1025310231

10254-
<pre class="webidl">
10232+
<pre class="idl">
1025510233
[Exposed=Window]
1025610234
interface Document : Node {
1025710235
[SameObject] readonly attribute DOMImplementation implementation;
@@ -10375,7 +10353,7 @@ <h4>3.3.13. `SecureContext^x</h4>
1037510353
The following IDL fragment defines an interface with one operation that is executable from all contexts, and two which are executable only from secure contexts.
1037610354
</p>
1037710355

10378-
<pre class="webidl">
10356+
<pre class="idl">
1037910357
[Exposed=Window]
1038010358
interface ExampleFeature {
1038110359
/* <span class="comment">
@@ -10520,7 +10498,7 @@ <h4>3.3.14. `Unscopable^x</h4>
1052010498
For example, with the following IDL:
1052110499
</p>
1052210500

10523-
<pre class="webidl">
10501+
<pre class="idl">
1052410502
[Exposed=Window]
1052510503
interface Thing {
1052610504
undefined f();
@@ -10678,7 +10656,7 @@ <h4>3.4.1. `LegacyFactoryFunction^x</h4>
1067810656
The following IDL defines an interface that uses the [LegacyFactoryFunction] extended attribute.
1067910657
</p>
1068010658

10681-
<pre class="webidl">
10659+
<pre class="idl">
1068210660
[Exposed=Window,
1068310661
LegacyFactoryFunction=Audio(DOMString %src)]
1068410662
interface HTMLAudioElement : HTMLMediaElement {
@@ -10797,7 +10775,7 @@ <h4>3.4.2. `LegacyLenientSetter^x</h4>
1079710775
The following IDL fragment defines an interface that uses the [LegacyLenientSetter] extended attribute.
1079810776
</p>
1079910777

10800-
<pre class="webidl">
10778+
<pre class="idl">
1080110779
[Exposed=Window]
1080210780
interface Example {
1080310781
[LegacyLenientSetter] readonly attribute DOMString x;
@@ -10890,7 +10868,7 @@ <h4>3.4.3. `LegacyLenientThis^x</h4>
1089010868
The following IDL fragment defines an interface that uses the [LegacyLenientThis] extended attribute.
1089110869
</p>
1089210870

10893-
<pre class="webidl">
10871+
<pre class="idl">
1089410872
[Exposed=Window]
1089510873
interface Example {
1089610874
[LegacyLenientThis] attribute DOMString x;
@@ -11007,7 +10985,7 @@ <h4>3.4.4. `LegacyNamespace^x</h4>
1100710985
The following IDL fragment defines a namespace and an interface which uses [LegacyNamespace] to be defined inside of it.
1100810986
</p>
1100910987

11010-
<pre class="webidl">
10988+
<pre class="idl">
1101110989
[Exposed=Window]【!*原文抜け】
1101210990
namespace Foo { };
1101310991

@@ -11083,7 +11061,7 @@ <h4>3.4.5. `LegacyNoInterfaceObject^x</h4>
1108311061
The following IDL fragment defines two interfaces, one whose interface object is exposed on the JavaScript global object, and one whose isn’t:
1108411062
</p>
1108511063

11086-
<pre class="webidl">
11064+
<pre class="idl">
1108711065
[Exposed=Window]
1108811066
interface Storage {
1108911067
undefined addEntry(unsigned long %key, any %value);
@@ -11185,7 +11163,7 @@ <h4>3.4.6. `LegacyNullToEmptyString^x</h4>
1118511163
The following IDL fragment defines an interface that has one attribute whose type has the extended attribute, and one operation whose argument’s type has the extended attribute:
1118611164
</p>
1118711165

11188-
<pre class="webidl">
11166+
<pre class="idl">
1118911167
[Exposed=Window]
1119011168
interface Dog {
1119111169
attribute DOMString name;
@@ -11319,7 +11297,7 @@ <h4>3.4.7. `LegacyOverrideBuiltIns^x</h4>
1131911297
The following IDL fragment defines two interfaces, one that has a named property getter and one that does not.
1132011298
</p>
1132111299

11322-
<pre class="webidl">
11300+
<pre class="idl">
1132311301
[Exposed=Window]
1132411302
interface StringMap {
1132511303
readonly attribute unsigned long length;
@@ -11447,7 +11425,7 @@ <h4>3.4.8. `LegacyTreatNonObjectAsNull^x</h4>
1144711425
The following IDL fragment defines an interface that has one attribute whose type is a [LegacyTreatNonObjectAsNull]-annotated callback function and another whose type is a callback function without the extended attribute:
1144811426
</p>
1144911427

11450-
<pre class="webidl">
11428+
<pre class="idl">
1145111429
callback OccurrenceHandler = undefined (DOMString %details);
1145211430

1145311431
[LegacyTreatNonObjectAsNull]
@@ -11655,7 +11633,7 @@ <h4>3.4.10. `LegacyUnforgeable^x</h4>
1165511633
For example, the following is disallowed:
1165611634
</p>
1165711635

11658-
<pre class="webidl">
11636+
<pre class="idl">
1165911637
[Exposed=Window]
1166011638
interface A1 {
1166111639
[LegacyUnforgeable] readonly attribute DOMString x;
@@ -11704,7 +11682,7 @@ <h4>3.4.10. `LegacyUnforgeable^x</h4>
1170411682
The following IDL fragment defines an interface that has two attributes, one of which is designated as [LegacyUnforgeable]:
1170511683
</p>
1170611684

11707-
<pre class="webidl">
11685+
<pre class="idl">
1170811686
[Exposed=Window]
1170911687
interface System {
1171011688
[LegacyUnforgeable] readonly attribute DOMString username;
@@ -11847,7 +11825,7 @@ <h4>3.4.11. `LegacyWindowAlias^x</h4>
1184711825
The following IDL defines an interface that uses the [LegacyWindowAlias] extended attribute.
1184811826
</p>
1184911827

11850-
<pre class="webidl">
11828+
<pre class="idl">
1185111829
[Exposed=Window,
1185211830
LegacyWindowAlias=WebKitCSSMatrix]
1185311831
interface DOMMatrix : DOMMatrixReadOnly {
@@ -13697,7 +13675,7 @@ <h4 title="Interface prototype object">3.7.3. ~ifc原型~obj</h4>
1369713675
The interface prototype object of an interface that is defined with the [LegacyNoInterfaceObject] extended attribute will be accessible. For example, with the following IDL:
1369813676
</p>
1369913677

13700-
<pre class="webidl">
13678+
<pre class="idl">
1370113679
[Exposed=Window,
1370213680
LegacyNoInterfaceObject]
1370313681
interface Foo {
@@ -15379,7 +15357,7 @@ <h6 title="Default toJSON operation">3.7.7.1.1. 既定の~toJSON演算</h6>
1537915357
Only regular attributes of interfaces that declare a toJSON operation with a [Default] extended attribute are included, even if an inherited interface declares such a toJSON operation. For example, consider the following IDL fragment:
1538015358
</p>
1538115359

15382-
<pre class="webidl">
15360+
<pre class="idl">
1538315361
[Exposed=Window]
1538415362
interface A {
1538515363
[Default] object toJSON();
@@ -15438,7 +15416,7 @@ <h6 title="Default toJSON operation">3.7.7.1.1. 既定の~toJSON演算</h6>
1543815416
A toJSON operation can also be declared on an interface mixin (or partial interface) and is equivalent to declaring it on the original interface. For example, consider the following IDL fragment:
1543915417
</p>
1544015418

15441-
<pre class="webidl">
15419+
<pre class="idl">
1544215420
[Exposed=Window]
1544315421
interface D {
1544415422
attribute DOMString d;
@@ -22370,7 +22348,7 @@ <h4 title="Creating and throwing exceptions">3.14.3. 例外の作成-法と投
2237022348
The above algorithms restrict objects representing exceptions propagating out of a function object to be ones that are associated with the realm of that function object (i.e., the current realm at the time the function executes). For example, consider the IDL:
2237122349
</p>
2237222350

22373-
<pre class="webidl">
22351+
<pre class="idl">
2237422352
[Exposed=Window]
2237522353
interface MathUtils {
2237622354
/* <span class="comment">
@@ -22451,7 +22429,7 @@ <h4 title="Handling exceptions">3.14.4. 例外の取扱い</h4>
2245122429
The following IDL fragment defines two interfaces and an exception. The valueOf attribute on ExceptionThrower is defined to throw an exception whenever an attempt is made to get its value.
2245222430
</p>
2245322431

22454-
<pre class="webidl">
22432+
<pre class="idl">
2245522433
[Exposed=Window]
2245622434
interface Dahut {
2245722435
attribute DOMString type;

0 commit comments

Comments
 (0)