Skip to content

Commit

Permalink
More test around text decoration styling (#2327)
Browse files Browse the repository at this point in the history
* Feature detect for text-decoration styling

* Take PR from @stefanpl and merge it with test for text-decoration-skip-ink
  • Loading branch information
rejas committed Jul 30, 2018
1 parent e2c27dc commit 04181ce
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
39 changes: 35 additions & 4 deletions feature-detects/css/textdecoration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
/*!
{
"name": "CSS textDecoration",
"property": "skipink",
"tags": ["css"]
"property": "textdecoration",
"caniuse": "text-decoration",
"tags": ["css"],
"notes": [{
"name" : "w3c explanation of individual text-decoration properties",
"href": "https://www.w3.org/TR/css-text-decor-3/#line-decoration"
}]
}
!*/
define(['Modernizr', 'testProp'], function(Modernizr, testProp) {
Modernizr.addTest('skipInk', testProp('textDecorationSkipInk', 'auto'));
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {

(function() {

Modernizr.addTest('textdecoration', function() {
var bool = false;
var test = testAllProps('textDecoration');
try {
bool = !!test;
if (bool) {
bool = new Boolean(bool);
}
} catch (e) {}

return bool;
});

var props = ['Line', 'Style', 'Color', 'Skip', 'SkipInk'];
var name, test;

for (var i = 0; i < props.length; i++) {
name = props[i].toLowerCase();
test = testAllProps('textDecoration' + props[i]);

Modernizr.addTest('textdecoration.' + name, test);
}
})();

});
2 changes: 1 addition & 1 deletion lib/config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"css/supports",
"css/target",
"css/textalignlast",
"css/textshadow",
"css/textdecoration",
"css/textshadow",
"css/transforms",
"css/transformslevel2",
"css/transforms3d",
Expand Down

0 comments on commit 04181ce

Please sign in to comment.