Skip to content

Commit 5c80179

Browse files
committed
replace *Properties with *Declaration
1 parent 5f70944 commit 5c80179

7 files changed

Lines changed: 36 additions & 24 deletions

File tree

baselines/dom.generated.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4821,7 +4821,7 @@ interface CSSFontFaceRule extends CSSRule {
48214821
*
48224822
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule/style)
48234823
*/
4824-
get style(): CSSStyleProperties;
4824+
get style(): CSSStyleDeclaration;
48254825
set style(cssText: string);
48264826
}
48274827

@@ -4991,7 +4991,7 @@ interface CSSKeyframeRule extends CSSRule {
49914991
*
49924992
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/style)
49934993
*/
4994-
get style(): CSSStyleProperties;
4994+
get style(): CSSStyleDeclaration;
49954995
set style(cssText: string);
49964996
}
49974997

@@ -5326,7 +5326,7 @@ interface CSSNestedDeclarations extends CSSRule {
53265326
*
53275327
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNestedDeclarations/style)
53285328
*/
5329-
get style(): CSSStyleProperties;
5329+
get style(): CSSStyleDeclaration;
53305330
set style(cssText: string);
53315331
}
53325332

@@ -7417,7 +7417,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74177417
*
74187418
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74197419
*/
7420-
get style(): CSSStyleProperties;
7420+
get style(): CSSStyleDeclaration;
74217421
set style(cssText: string);
74227422
/**
74237423
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
@@ -11461,7 +11461,7 @@ interface ElementCSSInlineStyle {
1146111461
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1146211462
readonly attributeStyleMap: StylePropertyMap;
1146311463
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11464-
get style(): CSSStyleProperties;
11464+
get style(): CSSStyleDeclaration;
1146511465
set style(cssText: string);
1146611466
}
1146711467

@@ -37358,7 +37358,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3735837358
*
3735937359
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3736037360
*/
37361-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37361+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3736237362
/**
3736337363
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3736437364
*
@@ -39460,7 +39460,7 @@ declare function focus(): void;
3946039460
*
3946139461
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3946239462
*/
39463-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39463+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3946439464
/**
3946539465
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3946639466
*

baselines/ts5.5/dom.generated.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4821,7 +4821,7 @@ interface CSSFontFaceRule extends CSSRule {
48214821
*
48224822
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule/style)
48234823
*/
4824-
readonly style: CSSStyleProperties;
4824+
readonly style: CSSStyleDeclaration;
48254825
}
48264826

48274827
declare var CSSFontFaceRule: {
@@ -4989,7 +4989,7 @@ interface CSSKeyframeRule extends CSSRule {
49894989
*
49904990
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/style)
49914991
*/
4992-
readonly style: CSSStyleProperties;
4992+
readonly style: CSSStyleDeclaration;
49934993
}
49944994

49954995
declare var CSSKeyframeRule: {
@@ -5322,7 +5322,7 @@ interface CSSNestedDeclarations extends CSSRule {
53225322
*
53235323
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNestedDeclarations/style)
53245324
*/
5325-
readonly style: CSSStyleProperties;
5325+
readonly style: CSSStyleDeclaration;
53265326
}
53275327

53285328
declare var CSSNestedDeclarations: {
@@ -7410,7 +7410,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74107410
*
74117411
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74127412
*/
7413-
readonly style: CSSStyleProperties;
7413+
readonly style: CSSStyleDeclaration;
74147414
/**
74157415
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
74167416
*
@@ -11451,7 +11451,7 @@ interface ElementCSSInlineStyle {
1145111451
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1145211452
readonly attributeStyleMap: StylePropertyMap;
1145311453
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11454-
readonly style: CSSStyleProperties;
11454+
readonly style: CSSStyleDeclaration;
1145511455
}
1145611456

1145711457
interface ElementContentEditable {
@@ -37335,7 +37335,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3733537335
*
3733637336
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3733737337
*/
37338-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37338+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3733937339
/**
3734037340
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3734137341
*
@@ -39437,7 +39437,7 @@ declare function focus(): void;
3943739437
*
3943839438
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3943939439
*/
39440-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39440+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3944139441
/**
3944239442
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3944339443
*

baselines/ts5.6/dom.generated.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4821,7 +4821,7 @@ interface CSSFontFaceRule extends CSSRule {
48214821
*
48224822
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule/style)
48234823
*/
4824-
get style(): CSSStyleProperties;
4824+
get style(): CSSStyleDeclaration;
48254825
set style(cssText: string);
48264826
}
48274827

@@ -4991,7 +4991,7 @@ interface CSSKeyframeRule extends CSSRule {
49914991
*
49924992
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/style)
49934993
*/
4994-
get style(): CSSStyleProperties;
4994+
get style(): CSSStyleDeclaration;
49954995
set style(cssText: string);
49964996
}
49974997

@@ -5326,7 +5326,7 @@ interface CSSNestedDeclarations extends CSSRule {
53265326
*
53275327
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNestedDeclarations/style)
53285328
*/
5329-
get style(): CSSStyleProperties;
5329+
get style(): CSSStyleDeclaration;
53305330
set style(cssText: string);
53315331
}
53325332

@@ -7417,7 +7417,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74177417
*
74187418
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74197419
*/
7420-
get style(): CSSStyleProperties;
7420+
get style(): CSSStyleDeclaration;
74217421
set style(cssText: string);
74227422
/**
74237423
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
@@ -11461,7 +11461,7 @@ interface ElementCSSInlineStyle {
1146111461
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1146211462
readonly attributeStyleMap: StylePropertyMap;
1146311463
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11464-
get style(): CSSStyleProperties;
11464+
get style(): CSSStyleDeclaration;
1146511465
set style(cssText: string);
1146611466
}
1146711467

@@ -37358,7 +37358,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3735837358
*
3735937359
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3736037360
*/
37361-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37361+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3736237362
/**
3736337363
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3736437364
*
@@ -39460,7 +39460,7 @@ declare function focus(): void;
3946039460
*
3946139461
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3946239462
*/
39463-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39463+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3946439464
/**
3946539465
* The **`getSelection()`** method of the Window interface returns the Selection object associated with the window's document, representing the range of text selected by the user or the current position of the caret.
3946639466
*

inputfiles/patches/cssom.kdl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
interface CSSStyleDeclaration \
66
forward=CSSStyleDeclarationBase \
77
forwardExtends=CSSStyleProperties
8+
9+
interface CSSStyleProperties replaceReference=CSSStyleDeclaration

src/build/emitter.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,15 +472,18 @@ export function emitWebIdl(
472472
if (baseTypeConversionMap.has(objDomType)) {
473473
return baseTypeConversionMap.get(objDomType)!;
474474
}
475-
// Name of an interface / enum / dict. Just return itself
475+
if (allInterfacesMap[objDomType]) {
476+
return allInterfacesMap[objDomType].replaceReference ?? objDomType;
477+
}
478+
// Name of an alias / callback / enum / dict. Just return itself
476479
if (
477-
allInterfacesMap[objDomType] ||
478480
allLegacyWindowAliases.includes(objDomType) ||
479481
allCallbackFunctionsMap[objDomType] ||
480482
allDictionariesMap[objDomType] ||
481483
allEnumsMap[objDomType]
482-
)
484+
) {
483485
return objDomType;
486+
}
484487
// Name of a type alias. Just return itself
485488
if (allTypedefsMap[objDomType]) return objDomType;
486489

src/build/patches.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ function handleMixinandInterfaces(
189189
"string",
190190
node.properties?.forwardExtends,
191191
),
192+
...optionalMember(
193+
"replaceReference",
194+
"string",
195+
node.properties?.replaceReference,
196+
),
192197
...handleTypeParameters(node.properties?.typeParameters),
193198
...interfaceObject,
194199
} as DeepPartial<Interface>;

src/build/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ export interface Interface {
155155
forward?: string;
156156
// "extends" for the original interface, in case `forward: true`.
157157
forwardExtends?: string;
158+
// replaces references from methods and properties
159+
replaceReference?: string;
158160
comment?: string;
159161
constants?: {
160162
constant: Record<string, Constant>;

0 commit comments

Comments
 (0)