@@ -4050,11 +4050,25 @@ const SUPPORTED_FEATURES = [
40504050 ]
40514051] ;
40524052
4053+ /**
4054+ * Whether a BCD support entry is the plain spelling arriving for good. One
4055+ * behind a flag is not support a page can rely on, one spelled with a prefix or
4056+ * another name is not the plain spelling at all, and one BCD later removed is
4057+ * support that ended — reading any of them as the arrival is what would let a
4058+ * construct be written for a target that cannot read it.
4059+ * @param {BcdSupport } entry a BCD support entry
4060+ * @returns {boolean } true when it is the plain spelling, still supported
4061+ */
4062+ const isPlainSupport = ( entry ) =>
4063+ ! entry . prefix &&
4064+ ! entry . alternative_name &&
4065+ ! entry . version_removed &&
4066+ ! entry . flags ;
4067+
40534068/**
40544069 * When each browser first read every one of a feature's constructs, as
4055- * `[browserslistName, since][]`. A prefixed, renamed or flagged arrival is not
4056- * one the plain spelling reaches, so it does not count; a browser BCD never
4057- * gives it carries `Infinity`, which no version satisfies.
4070+ * `[browserslistName, since][]`. Only a plain arrival counts, and a browser BCD
4071+ * never gives one carries `Infinity`, which no version satisfies.
40584072 * @param {string[] } paths BCD paths that all have to have arrived
40594073 * @returns {[string, number][] } the versions, by browserslist name
40604074 */
@@ -4073,9 +4087,7 @@ const collectSupportedFrom = (paths) => {
40734087 const names = BCD_TO_BROWSERSLIST . get ( bcdBrowser ) ;
40744088 if ( names === undefined ) continue ;
40754089 const entries = Array . isArray ( raw ) ? raw : [ raw ] ;
4076- const plain = entries . find (
4077- ( entry ) => ! entry . prefix && ! entry . alternative_name && ! entry . flags
4078- ) ;
4090+ const plain = entries . find ( isPlainSupport ) ;
40794091 const added = plain ? encodeVersion ( plain . version_added ) : null ;
40804092 for ( const name of names ) {
40814093 const before = since . get ( name ) ;
@@ -4189,22 +4201,10 @@ const collectPrefixes = (compat, name, alternatives) => {
41894201 const entries = Array . isArray ( raw ) ? raw : [ raw ] ;
41904202 let unprefixedFrom = null ;
41914203 for ( const entry of entries ) {
4192- // An entry BCD later removed never established unprefixed support — the
4193- // one it ends may be a partial implementation the next refines, but
4194- // reading a partial one as support is what would drop a spelling an
4195- // engine still needs (`-webkit-mask`, against a `mask` Chrome has
4196- // partially had since 1). One behind a flag is not support a page can
4197- // rely on, one spelled another way is not the unprefixed spelling at
4198- // all, and the earliest of the rest is the arrival — BCD's newest-first
4199- // ordering is convention, not schema.
4200- if (
4201- entry . prefix ||
4202- entry . alternative_name ||
4203- entry . version_removed ||
4204- entry . flags
4205- ) {
4206- continue ;
4207- }
4204+ // The earliest plain entry is the arrival — BCD's newest-first ordering is
4205+ // convention, not schema. Reading a removed one as support would drop
4206+ // `-webkit-mask` against a `mask` Chrome has only partially had since 1.
4207+ if ( ! isPlainSupport ( entry ) ) continue ;
42084208 const added = encodeVersion ( entry . version_added ) ;
42094209 if (
42104210 added !== null &&
@@ -4378,14 +4378,7 @@ const engineVersionLine = (bcdName, baseName, from) => {
43784378 /** @type {(support: BcdSupport | BcdSupport[] | undefined) => number | null } */
43794379 const unprefixed = ( support ) => {
43804380 const list = Array . isArray ( support ) ? support : support ? [ support ] : [ ] ;
4381- // The same reading of "arrived unprefixed" the window rule above uses.
4382- const entry = list . find (
4383- ( one ) =>
4384- ! one . prefix &&
4385- ! one . alternative_name &&
4386- ! one . version_removed &&
4387- ! one . flags
4388- ) ;
4381+ const entry = list . find ( isPlainSupport ) ;
43894382 return entry ? encodeVersion ( entry . version_added ) : null ;
43904383 } ;
43914384 /**
@@ -6157,6 +6150,7 @@ module.exports.collectUnsharedLonghandKeywords =
61576150 collectUnsharedLonghandKeywords ;
61586151module . exports . collectZeroUnitAmbiguousProperties =
61596152 collectZeroUnitAmbiguousProperties ;
6153+ module . exports . isPlainSupport = isPlainSupport ;
61606154module . exports . isSpelledSyntax = isSpelledSyntax ;
61616155module . exports . longhandType = longhandType ;
61626156module . exports . parseValueSyntax = parseValueSyntax ;
0 commit comments