Skip to content

Commit 77e5897

Browse files
authored
Introduce CSSStyleDeclarationBase (#2174)
Co-authored-by: saschanaz <[email protected]>
1 parent 8339493 commit 77e5897

File tree

9 files changed

+104
-42
lines changed

9 files changed

+104
-42
lines changed

baselines/dom.generated.d.ts

Lines changed: 14 additions & 11 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

@@ -5440,7 +5440,7 @@ declare var CSSNumericValue: {
54405440
*
54415441
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors)
54425442
*/
5443-
interface CSSPageDescriptors extends CSSStyleDeclaration {
5443+
interface CSSPageDescriptors extends CSSStyleDeclarationBase {
54445444
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin) */
54455445
margin: string;
54465446
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin-bottom) */
@@ -5518,7 +5518,7 @@ declare var CSSPerspective: {
55185518
*
55195519
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors)
55205520
*/
5521-
interface CSSPositionTryDescriptors extends CSSStyleDeclaration {
5521+
interface CSSPositionTryDescriptors extends CSSStyleDeclarationBase {
55225522
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
55235523
"align-self": string;
55245524
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
@@ -5992,7 +5992,7 @@ declare var CSSStartingStyleRule: {
59925992
*
59935993
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration)
59945994
*/
5995-
interface CSSStyleDeclaration {
5995+
interface CSSStyleDeclarationBase {
59965996
/**
59975997
* The **`cssText`** property of the CSSStyleDeclaration interface returns or sets the text of the element's **inline** style declaration only.
59985998
*
@@ -6044,12 +6044,15 @@ interface CSSStyleDeclaration {
60446044
[index: number]: string;
60456045
}
60466046

6047+
interface CSSStyleDeclaration extends CSSStyleProperties {
6048+
}
6049+
60476050
declare var CSSStyleDeclaration: {
60486051
prototype: CSSStyleDeclaration;
60496052
new(): CSSStyleDeclaration;
60506053
};
60516054

6052-
interface CSSStyleProperties extends CSSStyleDeclaration {
6055+
interface CSSStyleProperties extends CSSStyleDeclarationBase {
60536056
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/accent-color) */
60546057
accentColor: string;
60556058
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) */
@@ -7414,7 +7417,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74147417
*
74157418
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74167419
*/
7417-
get style(): CSSStyleProperties;
7420+
get style(): CSSStyleDeclaration;
74187421
set style(cssText: string);
74197422
/**
74207423
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
@@ -11458,7 +11461,7 @@ interface ElementCSSInlineStyle {
1145811461
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1145911462
readonly attributeStyleMap: StylePropertyMap;
1146011463
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11461-
get style(): CSSStyleProperties;
11464+
get style(): CSSStyleDeclaration;
1146211465
set style(cssText: string);
1146311466
}
1146411467

@@ -37355,7 +37358,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3735537358
*
3735637359
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3735737360
*/
37358-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37361+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3735937362
/**
3736037363
* 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.
3736137364
*
@@ -39457,7 +39460,7 @@ declare function focus(): void;
3945739460
*
3945839461
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3945939462
*/
39460-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39463+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3946139464
/**
3946239465
* 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.
3946339466
*

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

Lines changed: 14 additions & 11 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: {
@@ -5435,7 +5435,7 @@ declare var CSSNumericValue: {
54355435
*
54365436
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors)
54375437
*/
5438-
interface CSSPageDescriptors extends CSSStyleDeclaration {
5438+
interface CSSPageDescriptors extends CSSStyleDeclarationBase {
54395439
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin) */
54405440
margin: string;
54415441
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin-bottom) */
@@ -5512,7 +5512,7 @@ declare var CSSPerspective: {
55125512
*
55135513
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors)
55145514
*/
5515-
interface CSSPositionTryDescriptors extends CSSStyleDeclaration {
5515+
interface CSSPositionTryDescriptors extends CSSStyleDeclarationBase {
55165516
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
55175517
"align-self": string;
55185518
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
@@ -5985,7 +5985,7 @@ declare var CSSStartingStyleRule: {
59855985
*
59865986
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration)
59875987
*/
5988-
interface CSSStyleDeclaration {
5988+
interface CSSStyleDeclarationBase {
59895989
/**
59905990
* The **`cssText`** property of the CSSStyleDeclaration interface returns or sets the text of the element's **inline** style declaration only.
59915991
*
@@ -6037,12 +6037,15 @@ interface CSSStyleDeclaration {
60376037
[index: number]: string;
60386038
}
60396039

6040+
interface CSSStyleDeclaration extends CSSStyleProperties {
6041+
}
6042+
60406043
declare var CSSStyleDeclaration: {
60416044
prototype: CSSStyleDeclaration;
60426045
new(): CSSStyleDeclaration;
60436046
};
60446047

6045-
interface CSSStyleProperties extends CSSStyleDeclaration {
6048+
interface CSSStyleProperties extends CSSStyleDeclarationBase {
60466049
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/accent-color) */
60476050
accentColor: string;
60486051
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) */
@@ -7407,7 +7410,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74077410
*
74087411
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74097412
*/
7410-
readonly style: CSSStyleProperties;
7413+
readonly style: CSSStyleDeclaration;
74117414
/**
74127415
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
74137416
*
@@ -11448,7 +11451,7 @@ interface ElementCSSInlineStyle {
1144811451
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1144911452
readonly attributeStyleMap: StylePropertyMap;
1145011453
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11451-
readonly style: CSSStyleProperties;
11454+
readonly style: CSSStyleDeclaration;
1145211455
}
1145311456

1145411457
interface ElementContentEditable {
@@ -37332,7 +37335,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3733237335
*
3733337336
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3733437337
*/
37335-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37338+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3733637339
/**
3733737340
* 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.
3733837341
*
@@ -39434,7 +39437,7 @@ declare function focus(): void;
3943439437
*
3943539438
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3943639439
*/
39437-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39440+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3943839441
/**
3943939442
* 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.
3944039443
*

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

Lines changed: 14 additions & 11 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

@@ -5440,7 +5440,7 @@ declare var CSSNumericValue: {
54405440
*
54415441
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors)
54425442
*/
5443-
interface CSSPageDescriptors extends CSSStyleDeclaration {
5443+
interface CSSPageDescriptors extends CSSStyleDeclarationBase {
54445444
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin) */
54455445
margin: string;
54465446
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageDescriptors#margin-bottom) */
@@ -5518,7 +5518,7 @@ declare var CSSPerspective: {
55185518
*
55195519
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors)
55205520
*/
5521-
interface CSSPositionTryDescriptors extends CSSStyleDeclaration {
5521+
interface CSSPositionTryDescriptors extends CSSStyleDeclarationBase {
55225522
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
55235523
"align-self": string;
55245524
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPositionTryDescriptors#instance_properties) */
@@ -5992,7 +5992,7 @@ declare var CSSStartingStyleRule: {
59925992
*
59935993
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration)
59945994
*/
5995-
interface CSSStyleDeclaration {
5995+
interface CSSStyleDeclarationBase {
59965996
/**
59975997
* The **`cssText`** property of the CSSStyleDeclaration interface returns or sets the text of the element's **inline** style declaration only.
59985998
*
@@ -6044,12 +6044,15 @@ interface CSSStyleDeclaration {
60446044
[index: number]: string;
60456045
}
60466046

6047+
interface CSSStyleDeclaration extends CSSStyleProperties {
6048+
}
6049+
60476050
declare var CSSStyleDeclaration: {
60486051
prototype: CSSStyleDeclaration;
60496052
new(): CSSStyleDeclaration;
60506053
};
60516054

6052-
interface CSSStyleProperties extends CSSStyleDeclaration {
6055+
interface CSSStyleProperties extends CSSStyleDeclarationBase {
60536056
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/accent-color) */
60546057
accentColor: string;
60556058
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) */
@@ -7414,7 +7417,7 @@ interface CSSStyleRule extends CSSGroupingRule {
74147417
*
74157418
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style)
74167419
*/
7417-
get style(): CSSStyleProperties;
7420+
get style(): CSSStyleDeclaration;
74187421
set style(cssText: string);
74197422
/**
74207423
* The **`styleMap`** read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs.
@@ -11458,7 +11461,7 @@ interface ElementCSSInlineStyle {
1145811461
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */
1145911462
readonly attributeStyleMap: StylePropertyMap;
1146011463
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */
11461-
get style(): CSSStyleProperties;
11464+
get style(): CSSStyleDeclaration;
1146211465
set style(cssText: string);
1146311466
}
1146411467

@@ -37355,7 +37358,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
3735537358
*
3735637359
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3735737360
*/
37358-
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
37361+
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3735937362
/**
3736037363
* 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.
3736137364
*
@@ -39457,7 +39460,7 @@ declare function focus(): void;
3945739460
*
3945839461
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle)
3945939462
*/
39460-
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleProperties;
39463+
declare function getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
3946139464
/**
3946239465
* 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.
3946339466
*

inputfiles/patches/cssom.kdl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// CSSStyleDeclaration spec change broke a bunch of DT packages.
2+
// This tries to make existing usages work while still keeping the new
3+
// CSSStyleProperties.
4+
5+
interface CSSStyleDeclaration \
6+
forward=CSSStyleDeclarationBase \
7+
forwardExtends=CSSStyleProperties
8+
9+
interface CSSStyleProperties replaceReference=CSSStyleDeclaration

0 commit comments

Comments
 (0)