Skip to content

Commit fda65ed

Browse files
committed
[prefix-plugin] Actually prefix background-clip:text
1 parent 882cec9 commit fda65ed

11 files changed

+39
-4
lines changed

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ function prefixPlugin(){
624624
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis');
625625
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal');
626626
}
627+
} else if(fixers.WkBCTxt && property === 'background-clip' && value === 'text') {
628+
next.decl('-webkit-background-clip', value);
627629
} else {
628630
next.decl(
629631
fixers.properties[property] || fixers.fixProperty(property),

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ function prefixPlugin(){
626626
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis');
627627
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal');
628628
}
629+
} else if(fixers.WkBCTxt && property === 'background-clip' && value === 'text') {
630+
next.decl('-webkit-background-clip', value);
629631
} else {
630632
next.decl(
631633
fixers.properties[property] || fixers.fixProperty(property),

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ function prefixPlugin(){
625625
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis');
626626
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal');
627627
}
628+
} else if(fixers.WkBCTxt && property === 'background-clip' && value === 'text') {
629+
next.decl('-webkit-background-clip', value);
628630
} else {
629631
next.decl(
630632
fixers.properties[property] || fixers.fixProperty(property),

plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

plugins/prefix-browser/src/plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export function prefixPlugin(){
5656
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis')
5757
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal')
5858
}
59+
} else if(fixers.WkBCTxt && property === 'background-clip' && value === 'text') {
60+
next.decl('-webkit-background-clip', value)
5961
} else {
6062
next.decl(
6163
fixers.properties[property] || fixers.fixProperty(property),

plugins/prefix-browser/test-utils/exposed.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ function prefixPlugin(){
633633
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis');
634634
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal');
635635
}
636+
} else if(fixers.WkBCTxt && property === 'background-clip' && value === 'text') {
637+
next.decl('-webkit-background-clip', value);
636638
} else {
637639
next.decl(
638640
fixers.properties[property] || fixers.fixProperty(property),

plugins/prefix-browser/tests/test-detectors-webkit-compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var blankFixers = exposed.blankFixers
1414
var referenceFixers = Object.keys(blankFixers())
1515

1616

17-
o.spec('detectFunctions', function() {
17+
o.spec('Webkit prefies for Web compat', function() {
1818
var fixers
1919
o.beforeEach(function() {
2020
o(hasCleanState()).equals(true)('detector utils state isn\'t clean')

plugins/prefix-browser/tests/test-plugin-values-properties.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,29 @@ o.spec('plugin.decl for properties whose values are properties', function() {
124124

125125
o(fixers.properties).deepEquals({})
126126
})
127+
o('selectively prefix background-clip when the value is `text`', function(){
128+
mocks(global, {properties: {}})
129+
initBrowser()
130+
131+
fixers.prefix = ''
132+
133+
fixers.WkBCTxt = true
134+
var plugin = createPrefixPlugin()
135+
plugin.set.setPrefixDb(fixers)
136+
var sink = makeSink()
137+
var methods = plugin.filter(sink)
138+
139+
o(fixers.properties).deepEquals({})
140+
141+
methods.decl('background-clip', 'text')
142+
methods.decl('background-clip', 'border-box')
143+
144+
o(sink.buffer).deepEquals([
145+
['decl', '-webkit-background-clip', 'text'],
146+
['decl', 'background-clip', 'border-box']
147+
])
148+
149+
o(fixers.properties).deepEquals({'background-clip': 'background-clip'})
150+
151+
})
127152
})

0 commit comments

Comments
 (0)