mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-17 23:21:04 +00:00
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
/*!
|
|
{
|
|
"name": "Background Position Shorthand",
|
|
"property": "bgpositionshorthand",
|
|
"caniuse": "css-background-offsets",
|
|
"tags": ["css"],
|
|
"builderAliases": ["css_backgroundposition_shorthand"],
|
|
"notes": [{
|
|
"name": "MDN Docs",
|
|
"href": "https://developer.mozilla.org/en/CSS/background-position"
|
|
}, {
|
|
"name": "W3C Spec",
|
|
"href": "https://www.w3.org/TR/css3-background/#background-position"
|
|
}, {
|
|
"name": "Demo",
|
|
"href": "https://jsfiddle.net/Blink/bBXvt/"
|
|
}]
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Detects if you can use the shorthand method to define multiple parts of an
|
|
element's background-position simultaneously.
|
|
|
|
eg `background-position: right 10px bottom 10px`
|
|
*/
|
|
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
|
|
Modernizr.addTest('bgpositionshorthand', function() {
|
|
var elem = createElement('a');
|
|
var eStyle = elem.style;
|
|
var val = 'right 10px bottom 10px';
|
|
eStyle.cssText = 'background-position: ' + val + ';';
|
|
return (eStyle.backgroundPosition === val);
|
|
});
|
|
});
|