From dd540ce7353c7674d6a83bc035825affbfe7eebf Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 23 Jan 2020 18:46:45 +0100 Subject: [PATCH 1/3] test: add webkit properties --- lib/CSSStyleDeclaration.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/CSSStyleDeclaration.test.js b/lib/CSSStyleDeclaration.test.js index d0cba231..56e5f3a0 100644 --- a/lib/CSSStyleDeclaration.test.js +++ b/lib/CSSStyleDeclaration.test.js @@ -547,4 +547,20 @@ describe('CSSStyleDeclaration', () => { expect(style.getPropertyValue('--foo')).toEqual(''); expect(style.getPropertyValue('--fOo')).toEqual('purple'); }); + + test('implements webkitTextFillColor', () => { + const style = new CSSStyleDeclaration(); + style.setProperty('-webkit-text-fill-color', '#ffffff66'); + + expect(style.webkitTextFillColor).toEqual('rgba(255, 255, 255, 0.4)'); + }); + + test('vendor property with cssText', () => { + const style = new CSSStyleDeclaration(); + style.cssText = '-webkit-line-clamp: 20'; + + // TODO: this should be a number + expect(style.WebkitLineClamp).toEqual('20'); + expect(style.getPropertyValue('-webkit-line-clamp')).toEqual('20'); + }); }); From 9150db81b1f02d31ff14bfbdd6636a843fed68e0 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 23 Jan 2020 18:46:52 +0100 Subject: [PATCH 2/3] fix: webkit properties not being recognized --- lib/allWebkitProperties.js | 2 +- scripts/generate_implemented_properties.js | 11 +++++++++-- scripts/generate_properties.js | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/allWebkitProperties.js b/lib/allWebkitProperties.js index d6e71df6..57b2799b 100644 --- a/lib/allWebkitProperties.js +++ b/lib/allWebkitProperties.js @@ -191,4 +191,4 @@ module.exports = [ 'wrap-through', 'writing-mode', 'zoom', -].map(prop => 'webkit-' + prop); +].map(prop => '-webkit-' + prop); diff --git a/scripts/generate_implemented_properties.js b/scripts/generate_implemented_properties.js index caa88f12..0c21e969 100644 --- a/scripts/generate_implemented_properties.js +++ b/scripts/generate_implemented_properties.js @@ -9,8 +9,15 @@ const camelToDashed = require('../lib/parsers').camelToDashed; const dashedProperties = fs .readdirSync(path.resolve(__dirname, '../lib/properties')) .filter(propertyFile => propertyFile.substr(-3) === '.js') - .map(propertyFile => camelToDashed(propertyFile.replace('.js', ''))); - + .map(propertyFile => camelToDashed(propertyFile.replace('.js', ''))) + .map(property => { + const isVendorSpecific = /^(o|moz|ms|webkit)-/.test(property); + if (isVendorSpecific) { + return '-' + property; + } else { + return property; + } + }); const out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/implementedProperties.js'), { encoding: 'utf-8', }); diff --git a/scripts/generate_properties.js b/scripts/generate_properties.js index 33a42728..1298d28e 100644 --- a/scripts/generate_properties.js +++ b/scripts/generate_properties.js @@ -255,6 +255,10 @@ parsedFiles.forEach(function(file) { var propertyDefinitions = []; parsedFiles.forEach(function(file) { var dashed = camelToDashed(file.property); + var isVendorSpecific = /^(o|moz|ms|webkit)-/.test(dashed); + if (isVendorSpecific) { + dashed = '-' + dashed; + } propertyDefinitions.push( t.objectProperty( t.identifier(file.property), From 0f83daf6ec3e14959dfe8c66587318b9c33b28b7 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 31 Mar 2020 13:14:06 +0200 Subject: [PATCH 3/3] chore: format code --- lib/CSSStyleDeclaration.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CSSStyleDeclaration.test.js b/lib/CSSStyleDeclaration.test.js index ce0da49a..73c194b9 100644 --- a/lib/CSSStyleDeclaration.test.js +++ b/lib/CSSStyleDeclaration.test.js @@ -568,5 +568,5 @@ describe('CSSStyleDeclaration', () => { // TODO: this should be a number expect(style.WebkitLineClamp).toEqual('20'); expect(style.getPropertyValue('-webkit-line-clamp')).toEqual('20'); - }) + }); });