| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6898320 commit 5522fce
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,11 @@ | |||
| 1 | - export const lengthConv = new Map([ | ||
| 1 | + const lengthConv = new Map([ | ||
| 2 | 2 | ['in', 288], | |
| 3 | 3 | ['px', 3], | |
| 4 | 4 | ['pt', 4], | |
| 5 | 5 | ['pc', 48], | |
| 6 | 6 | ]); | |
| 7 | 7 | ||
| 8 | - export const metricConv = new Map([ | ||
| 8 | + const metricConv = new Map([ | ||
| 9 | 9 | ['cm', 40], | |
| 10 | 10 | ['mm', 4], | |
| 11 | 11 | ['q', 1], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import cssnanoUtils from 'cssnano-utils'; | |
| 2 | - import { syntaxAllowsPercentage } from './parse-syntax.js'; | ||
| 2 | + import { syntaxAllowsPercentage } from './parseSyntax.js'; | ||
| 3 | 3 | import { findReplacements, stripVendorPrefix } from './findReplacements.js'; | |
| 4 | 4 | ||
| 5 | 5 | const { applyEdits } = cssnanoUtils; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -500,4 +500,12 @@ describe('@property initial-value', () => { | |||
| 500 | 500 | `@property --test{syntax:/* a */ '<length>' /* b */;inherits:false;initial-value:0;}` | |
| 501 | 501 | ) | |
| 502 | 502 | ); | |
| 503 | + | ||
| 504 | + test( | ||
| 505 | + 'should reuse cached syntax evaluation for multiple initial-value declarations in @property', | ||
| 506 | + processCSS( | ||
| 507 | + `@property --percent{syntax:'<percentage>';inherits:false;initial-value:0%;initial-value:0%;}`, | ||
| 508 | + `@property --percent{syntax:'<percentage>';inherits:false;initial-value:0%;initial-value:0%;}` | ||
| 509 | + ) | ||
| 510 | + ); | ||
| 503 | 511 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,6 +131,9 @@ describe('Escaped and case-insensitive function names', () => { | |||
| 131 | 131 | ||
| 132 | 132 | const mozResult = await processor('div{width:-moz-calc(100% - 0px)}'); | |
| 133 | 133 | assert.equal(mozResult.css, 'div{width:-moz-calc(100% - 0px)}'); | |
| 134 | + | ||
| 135 | + const oResult = await processor('div{width:-o-calc(100% - 0px)}'); | ||
| 136 | + assert.equal(oResult.css, 'div{width:-o-calc(100% - 0px)}'); | ||
| 134 | 137 | }); | |
| 135 | 138 | ||
| 136 | 139 | test('should preserve zero units in vendor-prefixed conic-gradient names', async () => { | |
@@ -383,6 +386,13 @@ describe('Math functions and preserving units', () => { | |||
| 383 | 386 | ) | |
| 384 | 387 | ); | |
| 385 | 388 | ||
| 389 | + test( | ||
| 390 | + 'should preserve zero length and percentage units in anchor-size() fallbacks', | ||
| 391 | + passthroughCSS( | ||
| 392 | + 'h1{width:anchor-size(--target width, 0px);height:anchor-size(--target height, 0%);top:anchor-size(self-inline, 0rem)}' | ||
| 393 | + ) | ||
| 394 | + ); | ||
| 395 | + | ||
| 386 | 396 | test( | |
| 387 | 397 | 'should preserve zero percentage inside contrast-color()', | |
| 388 | 398 | passthroughCSS('h1{color:contrast-color(0%)}') | |
@@ -394,6 +404,21 @@ describe('Math functions and preserving units', () => { | |||
| 394 | 404 | 'h1{view-timeline-inset:view(0px 0px);animation-range:view(0%)}' | |
| 395 | 405 | ) | |
| 396 | 406 | ); | |
| 407 | + | ||
| 408 | + test( | ||
| 409 | + 'should preserve zero percentage in animation-timeline view() inset', | ||
| 410 | + passthroughCSS('h1{animation-timeline:view(0% 0%)}') | ||
| 411 | + ); | ||
| 412 | + | ||
| 413 | + test( | ||
| 414 | + 'should convert percentage to unitless zero in view-timeline-inset', | ||
| 415 | + processCSS('h1{view-timeline-inset:0%}', 'h1{view-timeline-inset:0}') | ||
| 416 | + ); | ||
| 417 | + | ||
| 418 | + test( | ||
| 419 | + 'should convert multiple percentages to unitless zeros in view-timeline-inset', | ||
| 420 | + processCSS('h1{view-timeline-inset:0% 0%}', 'h1{view-timeline-inset:0 0}') | ||
| 421 | + ); | ||
| 397 | 422 | }); | |
| 398 | 423 | ||
| 399 | 424 | describe('CSS custom property fallbacks (var)', () => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -166,6 +166,11 @@ describe('Length and viewport units', () => { | |||
| 166 | 166 | passthroughCSS('h1{-webkit-line-height:0px;-webkit-line-height:0%}') | |
| 167 | 167 | ); | |
| 168 | 168 | ||
| 169 | + test( | ||
| 170 | + 'should preserve zero units in -o- prefixed line-height', | ||
| 171 | + passthroughCSS('h1{-o-line-height:0px;-o-line-height:0%}') | ||
| 172 | + ); | ||
| 173 | + | ||
| 169 | 174 | test( | |
| 170 | 175 | 'should convert metric units (mm to cm)', | |
| 171 | 176 | processCSS( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - export declare const lengthConv: Map<string, number>; | ||
| 2 | - export declare const metricConv: Map<string, number>; | ||
| 3 | 1 | export declare const timeConv: Map<string, number>; | |
| 4 | 2 | export declare const angleConv: Map<string, number>; | |
| 5 | 3 | export declare const freqConv: Map<string, number>; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,3 @@ | |||
| 1 | 1 | /** @param {string} value @return {boolean} */ | |
| 2 | 2 | export declare function syntaxAllowsPercentage(value: string): boolean; | |
| 3 | - //# sourceMappingURL=parse-syntax.d.ts.map | ||
| 3 | + //# sourceMappingURL=parseSyntax.d.ts.map | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments