@@ -247,6 +247,37 @@ function isSuitable(
247247}
248248
249249export function getRemovalData ( webidl : Browser . WebIdl ) : Browser . WebIdl {
250+ const CSSStyleDeclarationKey = "CSSStyleDeclaration" ;
251+
252+ function shouldStyleBeRemoved ( key : string ) {
253+ const hyphenCase = camelToHyphenCase ( key ) ;
254+ const bcdCssItem = bcd . css . properties [ hyphenCase ] ;
255+ if (
256+ bcdCssItem &&
257+ isSuitable ( hyphenCase , bcdCssItem . __compat , CSSStyleDeclarationKey )
258+ ) {
259+ return false ;
260+ }
261+ if ( hyphenCase . startsWith ( "-webkit-" ) ) {
262+ const noPrefix = hyphenCase . slice ( 8 ) ;
263+ const bcdWebKitItem = bcd . css . properties [ noPrefix ] ;
264+ if (
265+ bcdWebKitItem &&
266+ isSuitable (
267+ noPrefix ,
268+ bcdWebKitItem . __compat ,
269+ CSSStyleDeclarationKey ,
270+ "-webkit-"
271+ )
272+ ) {
273+ return false ;
274+ }
275+ } else if ( forceKeepAlive [ CSSStyleDeclarationKey ] ?. includes ( key ) ) {
276+ return false ;
277+ }
278+ return true ;
279+ }
280+
250281 return mapToBcdCompat ( webidl , ( { key, parentKey, compat, mixin } ) => {
251282 // Allow:
252283 // * all mixins, for now
@@ -258,27 +289,8 @@ export function getRemovalData(webidl: Browser.WebIdl): Browser.WebIdl {
258289 return ;
259290 }
260291
261- if ( parentKey === "CSSStyleDeclaration" ) {
262- const hyphenCase = camelToHyphenCase ( key ) ;
263- const bcdCssItem = bcd . css . properties [ hyphenCase ] ;
264- if (
265- bcdCssItem &&
266- isSuitable ( hyphenCase , bcdCssItem . __compat , parentKey )
267- ) {
268- return ;
269- }
270- if ( hyphenCase . startsWith ( "-webkit-" ) ) {
271- const noPrefix = hyphenCase . slice ( 8 ) ;
272- const bcdWebKitItem = bcd . css . properties [ noPrefix ] ;
273- if (
274- bcdWebKitItem &&
275- isSuitable ( noPrefix , bcdWebKitItem . __compat , parentKey , "-webkit-" )
276- ) {
277- return ;
278- }
279- } else if ( forceKeepAlive [ parentKey ] ?. includes ( key ) ) {
280- return ;
281- }
292+ if ( parentKey === CSSStyleDeclarationKey && ! shouldStyleBeRemoved ( key ) ) {
293+ return ;
282294 }
283295
284296 return { exposed : "" } ;
@@ -330,6 +342,7 @@ function mapToBcdCompat(
330342 return { name : i . name , ...result } ;
331343 }
332344 }
345+
333346 const interfaces = filterMapRecord (
334347 webidl . interfaces ?. interface ,
335348 mapInterfaceLike
0 commit comments