Skip to content

Commit d0f4fd7

Browse files
committed
[css-layout-api] Static class getters are finally a thing.
1 parent 2036cb0 commit d0f4fd7

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

css-layout-api/EXPLAINER.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ are performing layout for, and all children. E.g.
226226

227227
```js
228228
registerLayout('style-read', class {
229-
static get inputProperties() { return ['--a-number']; }
230-
static get childInputProperties() { return ['--a-string']; }
229+
static inputProperties = ['--a-number'];
230+
static childInputProperties = ['--a-string'];
231231

232232
async layout(children, edges, constraints, styleMap) {
233233
// We can read our own style:
@@ -272,7 +272,7 @@ In the above `centering` example, we forced each `LayoutChild` to produce exactl
272272
We are able to ensure children do not blockify by setting the `childDisplay` to `normal`, e.g.
273273
```js
274274
registerLayout('example', class {
275-
static get layoutOptions() { return {childDisplay: 'normal'}; }
275+
static layoutOptions = {childDisplay: 'normal'};
276276
});
277277
```
278278

@@ -305,7 +305,7 @@ We pass the `BreakToken` to add back into the `layout()` call in order to produc
305305

306306
```js
307307
registerLayout('basic-inline', class {
308-
static get layoutOptions() { return {childDisplay: 'normal'}; }
308+
static layoutOptions = {childDisplay: 'normal'};
309309

310310
async layout(children, edges, constraints, styleMap) {
311311
// Determine our (inner) available size.

css-layout-api/Overview.bs

+7-6
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,12 @@ instances</dfn>. Initially this map is empty; it is populated when the user agen
308308
Note: The shape of the class should be:
309309
<pre class='lang-javascript'>
310310
registerLayout('example', class {
311-
static get inputProperties() { return ['--foo']; }
312-
static get childrenInputProperties() { return ['--bar']; }
313-
static get layoutOptions() {
314-
return {childDisplay: 'normal', sizing: 'block-like'}
315-
}
311+
static inputProperties = ['--foo'];
312+
static childrenInputProperties = ['--bar'];
313+
static layoutOptions = {
314+
childDisplay: 'normal',
315+
sizing: 'block-like'
316+
};
316317

317318
async intrinsicSizes(children, edges, styleMap) {
318319
// Intrinsic sizes code goes here.
@@ -505,7 +506,7 @@ The {{LayoutChild}} has internal slot(s):
505506
The example below shows the basic usage of a {{LayoutChild}}.
506507
<pre class='lang-javascript'>
507508
registerLayout('example-layout-child', class {
508-
static get childInputProperties() { return ['--foo']; }
509+
static childInputProperties = ['--foo'];
509510

510511
async layout(children, edges, constraints, styleMap) {
511512

0 commit comments

Comments
 (0)