Skip to content

Commit 06e3f87

Browse files
authored
Add CSSOM/Conditional Rules types (#716)
* Add CSSOM/Conditional Rules types * no CSSMarginRule implementation
1 parent 593bce1 commit 06e3f87

12 files changed

+259
-182
lines changed

baselines/dom.generated.d.ts

Lines changed: 32 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,13 +2623,6 @@ declare var CDATASection: {
26232623
new(): CDATASection;
26242624
};
26252625

2626-
/** Holds useful CSS-related methods. No object with this interface are implemented: it contains only static methods and therefore is a utilitarian interface. */
2627-
interface CSS {
2628-
escape(value: string): string;
2629-
supports(property: string, value?: string): boolean;
2630-
}
2631-
declare var CSS: CSS;
2632-
26332626
/** A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */
26342627
interface CSSConditionRule extends CSSGroupingRule {
26352628
conditionText: string;
@@ -2653,7 +2646,7 @@ declare var CSSFontFaceRule: {
26532646
interface CSSGroupingRule extends CSSRule {
26542647
readonly cssRules: CSSRuleList;
26552648
deleteRule(index: number): void;
2656-
insertRule(rule: string, index: number): number;
2649+
insertRule(rule: string, index?: number): number;
26572650
}
26582651

26592652
declare var CSSGroupingRule: {
@@ -2719,9 +2712,7 @@ declare var CSSNamespaceRule: {
27192712
};
27202713

27212714
/** CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). */
2722-
interface CSSPageRule extends CSSRule {
2723-
readonly pseudoClass: string;
2724-
readonly selector: string;
2715+
interface CSSPageRule extends CSSGroupingRule {
27252716
selectorText: string;
27262717
readonly style: CSSStyleDeclaration;
27272718
}
@@ -2747,8 +2738,6 @@ interface CSSRule {
27472738
readonly PAGE_RULE: number;
27482739
readonly STYLE_RULE: number;
27492740
readonly SUPPORTS_RULE: number;
2750-
readonly UNKNOWN_RULE: number;
2751-
readonly VIEWPORT_RULE: number;
27522741
}
27532742

27542743
declare var CSSRule: {
@@ -2764,8 +2753,6 @@ declare var CSSRule: {
27642753
readonly PAGE_RULE: number;
27652754
readonly STYLE_RULE: number;
27662755
readonly SUPPORTS_RULE: number;
2767-
readonly UNKNOWN_RULE: number;
2768-
readonly VIEWPORT_RULE: number;
27692756
};
27702757

27712758
/** A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. */
@@ -2886,14 +2873,13 @@ interface CSSStyleDeclaration {
28862873
content: string;
28872874
counterIncrement: string;
28882875
counterReset: string;
2889-
cssFloat: string | null;
2876+
cssFloat: string;
28902877
cssText: string;
28912878
cursor: string;
28922879
direction: string;
28932880
display: string;
28942881
dominantBaseline: string;
28952882
emptyCells: string;
2896-
enableBackground: string | null;
28972883
fill: string;
28982884
fillOpacity: string;
28992885
fillRule: string;
@@ -2925,7 +2911,6 @@ interface CSSStyleDeclaration {
29252911
fontVariantPosition: string;
29262912
fontWeight: string;
29272913
gap: string;
2928-
glyphOrientationHorizontal: string | null;
29292914
glyphOrientationVertical: string;
29302915
grid: string;
29312916
gridArea: string;
@@ -2949,17 +2934,10 @@ interface CSSStyleDeclaration {
29492934
hyphens: string;
29502935
imageOrientation: string;
29512936
imageRendering: string;
2952-
imeMode: string | null;
29532937
inlineSize: string;
29542938
justifyContent: string;
29552939
justifyItems: string;
29562940
justifySelf: string;
2957-
kerning: string | null;
2958-
layoutGrid: string | null;
2959-
layoutGridChar: string | null;
2960-
layoutGridLine: string | null;
2961-
layoutGridMode: string | null;
2962-
layoutGridType: string | null;
29632941
left: string;
29642942
readonly length: number;
29652943
letterSpacing: string;
@@ -2998,53 +2976,6 @@ interface CSSStyleDeclaration {
29982976
minHeight: string;
29992977
minInlineSize: string;
30002978
minWidth: string;
3001-
msContentZoomChaining: string | null;
3002-
msContentZoomLimit: string | null;
3003-
msContentZoomLimitMax: any;
3004-
msContentZoomLimitMin: any;
3005-
msContentZoomSnap: string | null;
3006-
msContentZoomSnapPoints: string | null;
3007-
msContentZoomSnapType: string | null;
3008-
msContentZooming: string | null;
3009-
msFlowFrom: string | null;
3010-
msFlowInto: string | null;
3011-
msFontFeatureSettings: string | null;
3012-
msGridColumn: any;
3013-
msGridColumnAlign: string | null;
3014-
msGridColumnSpan: any;
3015-
msGridColumns: string | null;
3016-
msGridRow: any;
3017-
msGridRowAlign: string | null;
3018-
msGridRowSpan: any;
3019-
msGridRows: string | null;
3020-
msHighContrastAdjust: string | null;
3021-
msHyphenateLimitChars: string | null;
3022-
msHyphenateLimitLines: any;
3023-
msHyphenateLimitZone: any;
3024-
msHyphens: string | null;
3025-
msImeAlign: string | null;
3026-
msOverflowStyle: string | null;
3027-
msScrollChaining: string | null;
3028-
msScrollLimit: string | null;
3029-
msScrollLimitXMax: any;
3030-
msScrollLimitXMin: any;
3031-
msScrollLimitYMax: any;
3032-
msScrollLimitYMin: any;
3033-
msScrollRails: string | null;
3034-
msScrollSnapPointsX: string | null;
3035-
msScrollSnapPointsY: string | null;
3036-
msScrollSnapType: string | null;
3037-
msScrollSnapX: string | null;
3038-
msScrollSnapY: string | null;
3039-
msScrollTranslation: string | null;
3040-
msTextCombineHorizontal: string | null;
3041-
msTextSizeAdjust: any;
3042-
msTouchAction: string | null;
3043-
msTouchSelect: string | null;
3044-
msUserSelect: string | null;
3045-
msWrapFlow: string;
3046-
msWrapMargin: any;
3047-
msWrapThrough: string;
30482979
objectFit: string;
30492980
objectPosition: string;
30502981
opacity: string;
@@ -3073,22 +3004,20 @@ interface CSSStyleDeclaration {
30733004
pageBreakBefore: string;
30743005
pageBreakInside: string;
30753006
paintOrder: string;
3076-
readonly parentRule: CSSRule;
3077-
penAction: string | null;
3007+
readonly parentRule: CSSRule | null;
30783008
perspective: string;
30793009
perspectiveOrigin: string;
30803010
placeContent: string;
30813011
placeItems: string;
30823012
placeSelf: string;
3083-
pointerEvents: string | null;
3013+
pointerEvents: string;
30843014
position: string;
30853015
quotes: string;
30863016
resize: string;
30873017
right: string;
30883018
rotate: string;
30893019
rowGap: string;
30903020
rubyAlign: string;
3091-
rubyOverhang: string | null;
30923021
rubyPosition: string;
30933022
scale: string;
30943023
scrollBehavior: string;
@@ -3119,8 +3048,6 @@ interface CSSStyleDeclaration {
31193048
textEmphasisStyle: string;
31203049
textIndent: string;
31213050
textJustify: string;
3122-
textKashida: string | null;
3123-
textKashidaSpace: string | null;
31243051
textOrientation: string;
31253052
textOverflow: string;
31263053
textRendering: string;
@@ -3181,7 +3108,6 @@ interface CSSStyleDeclaration {
31813108
webkitBorderBottomLeftRadius: string;
31823109
/** @deprecated */
31833110
webkitBorderBottomRightRadius: string;
3184-
webkitBorderImage: string | null;
31853111
/** @deprecated */
31863112
webkitBorderRadius: string;
31873113
/** @deprecated */
@@ -3190,7 +3116,6 @@ interface CSSStyleDeclaration {
31903116
webkitBorderTopRightRadius: string;
31913117
/** @deprecated */
31923118
webkitBoxAlign: string;
3193-
webkitBoxDirection: string | null;
31943119
/** @deprecated */
31953120
webkitBoxFlex: string;
31963121
/** @deprecated */
@@ -3203,18 +3128,6 @@ interface CSSStyleDeclaration {
32033128
webkitBoxShadow: string;
32043129
/** @deprecated */
32053130
webkitBoxSizing: string;
3206-
webkitColumnBreakAfter: string | null;
3207-
webkitColumnBreakBefore: string | null;
3208-
webkitColumnBreakInside: string | null;
3209-
webkitColumnCount: any;
3210-
webkitColumnGap: any;
3211-
webkitColumnRule: string | null;
3212-
webkitColumnRuleColor: any;
3213-
webkitColumnRuleStyle: string | null;
3214-
webkitColumnRuleWidth: any;
3215-
webkitColumnSpan: string | null;
3216-
webkitColumnWidth: any;
3217-
webkitColumns: string | null;
32183131
/** @deprecated */
32193132
webkitFilter: string;
32203133
/** @deprecated */
@@ -3268,7 +3181,7 @@ interface CSSStyleDeclaration {
32683181
webkitPerspective: string;
32693182
/** @deprecated */
32703183
webkitPerspectiveOrigin: string;
3271-
webkitTapHighlightColor: string | null;
3184+
webkitTapHighlightColor: string;
32723185
/** @deprecated */
32733186
webkitTextFillColor: string;
32743187
/** @deprecated */
@@ -3295,9 +3208,8 @@ interface CSSStyleDeclaration {
32953208
webkitTransitionProperty: string;
32963209
/** @deprecated */
32973210
webkitTransitionTimingFunction: string;
3298-
webkitUserModify: string | null;
3299-
webkitUserSelect: string | null;
3300-
webkitWritingMode: string | null;
3211+
/** @deprecated */
3212+
webkitUserSelect: string;
33013213
whiteSpace: string;
33023214
widows: string;
33033215
width: string;
@@ -3307,12 +3219,13 @@ interface CSSStyleDeclaration {
33073219
wordWrap: string;
33083220
writingMode: string;
33093221
zIndex: string;
3310-
zoom: string | null;
3311-
getPropertyPriority(propertyName: string): string;
3312-
getPropertyValue(propertyName: string): string;
3222+
/** @deprecated */
3223+
zoom: string;
3224+
getPropertyPriority(property: string): string;
3225+
getPropertyValue(property: string): string;
33133226
item(index: number): string;
3314-
removeProperty(propertyName: string): string;
3315-
setProperty(propertyName: string, value: string | null, priority?: string | null): void;
3227+
removeProperty(property: string): string;
3228+
setProperty(property: string, value: string | null, priority?: string): void;
33163229
[index: number]: string;
33173230
}
33183231

@@ -3335,34 +3248,12 @@ declare var CSSStyleRule: {
33353248
/** A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */
33363249
interface CSSStyleSheet extends StyleSheet {
33373250
readonly cssRules: CSSRuleList;
3338-
/** @deprecated */
3339-
cssText: string;
3340-
/** @deprecated */
3341-
readonly id: string;
3342-
/** @deprecated */
3343-
readonly imports: StyleSheetList;
3344-
/** @deprecated */
3345-
readonly isAlternate: boolean;
3346-
/** @deprecated */
3347-
readonly isPrefAlternate: boolean;
33483251
readonly ownerRule: CSSRule | null;
3349-
/** @deprecated */
3350-
readonly owningElement: Element;
3351-
/** @deprecated */
3352-
readonly pages: any;
3353-
/** @deprecated */
3354-
readonly readOnly: boolean;
33553252
readonly rules: CSSRuleList;
3356-
/** @deprecated */
3357-
addImport(bstrURL: string, lIndex?: number): number;
3358-
/** @deprecated */
3359-
addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;
3360-
addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;
3361-
deleteRule(index?: number): void;
3253+
addRule(selector?: string, style?: string, index?: number): number;
3254+
deleteRule(index: number): void;
33623255
insertRule(rule: string, index?: number): number;
3363-
/** @deprecated */
3364-
removeImport(lIndex: number): void;
3365-
removeRule(lIndex: number): void;
3256+
removeRule(index?: number): void;
33663257
}
33673258

33683259
declare var CSSStyleSheet: {
@@ -3438,7 +3329,7 @@ interface CanvasFillStrokeStyles {
34383329
fillStyle: string | CanvasGradient | CanvasPattern;
34393330
strokeStyle: string | CanvasGradient | CanvasPattern;
34403331
createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
3441-
createPattern(image: CanvasImageSource, repetition: string): CanvasPattern | null;
3332+
createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
34423333
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
34433334
}
34443335

@@ -9905,7 +9796,7 @@ declare var KeyframeEffect: {
99059796
};
99069797

99079798
interface LinkStyle {
9908-
readonly sheet: StyleSheet | null;
9799+
readonly sheet: CSSStyleSheet | null;
99099800
}
99109801

99119802
interface ListeningStateChangedEvent extends Event {
@@ -12026,7 +11917,7 @@ interface PositionError {
1202611917
}
1202711918

1202811919
/** A processing instruction embeds application-specific instructions in XML which can be ignored by other applications that don't recognize them. */
12029-
interface ProcessingInstruction extends CharacterData {
11920+
interface ProcessingInstruction extends CharacterData, LinkStyle {
1203011921
readonly target: string;
1203111922
}
1203211923

@@ -13195,7 +13086,7 @@ interface SVGElementEventMap extends ElementEventMap, GlobalEventHandlersEventMa
1319513086
}
1319613087

1319713088
/** All of the SVG DOM interfaces that correspond directly to elements in the SVG language derive from the SVGElement interface. */
13198-
interface SVGElement extends Element, DocumentAndElementEventHandlers, ElementCSSInlineStyle, GlobalEventHandlers, HTMLOrSVGElement, SVGElementInstance {
13089+
interface SVGElement extends Element, DocumentAndElementEventHandlers, DocumentAndElementEventHandlers, ElementCSSInlineStyle, GlobalEventHandlers, GlobalEventHandlers, HTMLOrSVGElement, SVGElementInstance {
1319913090
/** @deprecated */
1320013091
readonly className: any;
1320113092
readonly ownerSVGElement: SVGSVGElement | null;
@@ -15595,8 +15486,8 @@ interface StyleSheet {
1559515486
disabled: boolean;
1559615487
readonly href: string | null;
1559715488
readonly media: MediaList;
15598-
readonly ownerNode: Node;
15599-
readonly parentStyleSheet: StyleSheet | null;
15489+
readonly ownerNode: Element | ProcessingInstruction | null;
15490+
readonly parentStyleSheet: CSSStyleSheet | null;
1560015491
readonly title: string | null;
1560115492
readonly type: string;
1560215493
}
@@ -15609,8 +15500,8 @@ declare var StyleSheet: {
1560915500
/** A list of StyleSheet. */
1561015501
interface StyleSheetList {
1561115502
readonly length: number;
15612-
item(index: number): StyleSheet | null;
15613-
[index: number]: StyleSheet;
15503+
item(index: number): CSSStyleSheet | null;
15504+
[index: number]: CSSStyleSheet;
1561415505
}
1561515506

1561615507
declare var StyleSheetList: {
@@ -19150,6 +19041,13 @@ declare var webkitRTCPeerConnection: {
1915019041

1915119042
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
1915219043

19044+
/** Holds useful CSS-related methods. No object with this interface are implemented: it contains only static methods and therefore is a utilitarian interface. */
19045+
declare namespace CSS {
19046+
function escape(ident: string): string;
19047+
function supports(property: string, value: string): boolean;
19048+
function supports(conditionText: string): boolean;
19049+
}
19050+
1915319051
declare namespace WebAssembly {
1915419052
interface CompileError {
1915519053
}

baselines/dom.iterable.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ interface SpeechRecognitionResultList {
225225
}
226226

227227
interface StyleSheetList {
228-
[Symbol.iterator](): IterableIterator<StyleSheet>;
228+
[Symbol.iterator](): IterableIterator<CSSStyleSheet>;
229229
}
230230

231231
interface TextTrackCueList {

baselines/webworker.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ interface CanvasFillStrokeStyles {
763763
fillStyle: string | CanvasGradient | CanvasPattern;
764764
strokeStyle: string | CanvasGradient | CanvasPattern;
765765
createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
766-
createPattern(image: CanvasImageSource, repetition: string): CanvasPattern | null;
766+
createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
767767
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
768768
}
769769

0 commit comments

Comments
 (0)