Skip to content

Commit

Permalink
Good chunk of CSS Meta Data
Browse files Browse the repository at this point in the history
  • Loading branch information
SlexAxton committed Mar 5, 2013
1 parent c838184 commit 205a098
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 34 deletions.
14 changes: 12 additions & 2 deletions feature-detects/css/lastchild.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/*!
{
"name": "CSS :last-child pseudo-selector",
"caniuse": "",X
"property": "lastchild",
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/pull/304"
}]
}
!*/
define(['Modernizr', 'testStyles'], function( Modernizr, testStyles ) {
// last-child pseudo selector
// https://github.com/Modernizr/Modernizr/pull/304
testStyles("#modernizr div {width:100px} #modernizr :last-child{width:200px;display:block}", function( elem ) {
Modernizr.addTest('lastchild', elem.lastChild.offsetWidth > elem.firstChild.offsetWidth);
}, 2);
Expand Down
38 changes: 27 additions & 11 deletions feature-detects/css/mask.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
/*!
{
"name": "CSS Mask",
"caniuse": "",X
"property": "lastchild",

This comment has been minimized.

Copy link
@doctyper

doctyper Jun 5, 2013

Member

Noticed this during testing. This property should be "mask", correct?

This comment has been minimized.

Copy link
@stucox

stucox Jun 5, 2013

Member

I think this is fixed on master now (as is the typo on the line above): https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/mask.js

This comment has been minimized.

Copy link
@doctyper

doctyper Jun 5, 2013

Member

No, it's still incorrect on master. This is just the originating commit.

This comment has been minimized.

Copy link
@stucox

stucox Jun 5, 2013

Member

Sorry yeah I'm being blind. Fixed.

"tags": ["css"],
"notes": [
"This is for the -webkit-mask feature, not for the similar svg mask in Firefox.",
{
"name": "Webkit blog on CSS Masks",
"href": "http://www.webkit.org/blog/181/css-masks/"
},
{
"name": "Safari Docs",
"href": "http://developer.apple.com/library/safari/#documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Masks/Masks.html"
},
{
"name": "Mozilla css svg mask (not this)",
"href": "http://developer.mozilla.org/en/CSS/mask"
},
{
"name": "Combine with clippaths for awesomeness",
"href": "http://generic.cx/for/webkit/test.html"
}
]
}
!*/
define(['Modernizr', 'testAllProps'], function( Modernizr, testAllProps ) {
// this tests passes for webkit's proprietary `-webkit-mask` feature
// www.webkit.org/blog/181/css-masks/
// developer.apple.com/library/safari/#documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Masks/Masks.html

// it does not pass mozilla's implementation of `mask` for SVG

// developer.mozilla.org/en/CSS/mask
// developer.mozilla.org/En/Applying_SVG_effects_to_HTML_content

// Can combine with clippaths for awesomeness: http://generic.cx/for/webkit/test.html

Modernizr.addTest('cssmask', testAllProps('maskRepeat'));
});
8 changes: 8 additions & 0 deletions feature-detects/css/mediaqueries.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*!
{
"name": "CSS Media Queries",
"caniuse": "",X
"property": "mediaqueries",
"tags": ["css"]
}
!*/
define(['Modernizr', 'mq'], function( Modernizr, mq ) {
Modernizr.addTest('mediaqueries', mq('only all'));
});
8 changes: 8 additions & 0 deletions feature-detects/css/multiplebgs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*!
{
"name": "CSS Multiple Backgrounds",
"caniuse": "",X
"property": "multiplebgs",
"tags": ["css"]
}
!*/
define(['Modernizr', 'createElement'], function( Modernizr, createElement ) {
// Setting multiple images AND a color on the background shorthand property
// and then querying the style.background property value for the number of
Expand Down
13 changes: 12 additions & 1 deletion feature-detects/css/objectfit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
/*!
{
"name": "CSS Object Fit",
"caniuse": "",X
"property": "objectfit",
"tags": ["css"],
"notes": [{
"name": "Opera Article on Object Fit",
"href": "http://dev.opera.com/articles/view/css3-object-fit-object-position/"
}]
}
!*/
define(['Modernizr', 'prefixed'], function( Modernizr, prefixed ) {
// dev.opera.com/articles/view/css3-object-fit-object-position/
Modernizr.addTest('objectfit', !!prefixed('objectFit'), { aliases: ['object-fit'] });
});
9 changes: 9 additions & 0 deletions feature-detects/css/opacity.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*!
{
"name": "CSS Opacity",
"caniuse": "",X
"property": "opacity",
"tags": ["css"],
"notes": ["Opacity must be be in the range of [0.0,1.0], according to the spec."]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function( Modernizr, createElement, prefixes ) {
// Browsers that actually have CSS Opacity implemented have done so
// according to spec, which means their return values are within the
Expand Down
17 changes: 14 additions & 3 deletions feature-detects/css/overflow-scrolling.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
/*!
{
"name": "CSS Object Fit",
"caniuse": "",X
"property": "overflowscrolling",
"tags": ["css"],
"warnings": ["Introduced in iOS5b2. API is subject to change."]
"notes": [{
"name": "Article on iOS overflow scrolling",
"href": "http://johanbrook.com/browsers/native-momentum-scrolling-ios-5/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function( Modernizr, testAllProps ) {
// johanbrook.com/browsers/native-momentum-scrolling-ios-5/
// introduced in iOS5b2. Possible API may change...
Modernizr.addTest("overflowscrolling", testAllProps("overflowScrolling"));
Modernizr.addTest('overflowscrolling', testAllProps('overflowScrolling'));
});
32 changes: 25 additions & 7 deletions feature-detects/css/pointerevents.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
/*!
{
"name": "CSS Pointer Events",
"caniuse": "",X
"property": "csspointerevents",
"authors": ["ausi"],
"tags": ["css"],
"notes": [
{
"name": "MDN Docs",
"href": "http://developer.mozilla.org/en/CSS/pointer-events"
},{
"name": "Test Project Page",
"href": "http://ausi.github.com/Feature-detection-technique-for-pointer-events/"
},{
"name": "Test Project Wiki",
"href": "http://github.com/ausi/Feature-detection-technique-for-pointer-events/wiki"
},
{
"name": "Related Github Issue",
"href": "http://github.com/Modernizr/Modernizr/issues/80"
}
]
}
!*/
define(['Modernizr', 'createElement', 'docElement'], function( Modernizr, createElement, docElement ) {
// developer.mozilla.org/en/CSS/pointer-events

// Test and project pages:
// ausi.github.com/Feature-detection-technique-for-pointer-events/
// github.com/ausi/Feature-detection-technique-for-pointer-events/wiki
// github.com/Modernizr/Modernizr/issues/80

Modernizr.addTest('csspointerevents', function() {
var element = createElement('x');
var getComputedStyle = window.getComputedStyle;
Expand Down
8 changes: 8 additions & 0 deletions feature-detects/css/positionsticky.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*!
{
"name": "CSS position: sticky",
"caniuse": "",X
"property": "csspositionsticky",
"tags": ["css"]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function( Modernizr, createElement, prefixes ) {
// Sticky positioning - constrains an element to be positioned inside the
// intersection of its container box, and the viewport.
Expand Down
8 changes: 8 additions & 0 deletions feature-detects/css/reflections.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*!
{
"name": "CSS Reflections",
"caniuse": "",X
"property": "cssreflections",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function( Modernizr, testAllProps ) {
Modernizr.addTest('cssreflections', testAllProps('boxReflect'));
});
17 changes: 13 additions & 4 deletions feature-detects/css/regions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
/*!
{
"name": "CSS Regions",
"caniuse": "",X
"authors": ["Mihai Balan"]
"property": "regions",
"tags": ["css"],
"notes": [{
"name": "W3C Specification",
"href": "http://www.w3.org/TR/css3-regions/"
}]
}
!*/
define(['Modernizr', 'createElement', 'docElement'], function( Modernizr, createElement, docElement ) {
// CSS Regions
// http://www.w3.org/TR/css3-regions/
// By: Mihai Balan

// We start with a CSS parser test then we check page geometry to see if it's affected by regions
// Later we might be able to retire the second part, as WebKit builds with the false positives die out

Expand Down
21 changes: 16 additions & 5 deletions feature-detects/css/remunit.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
/*!
{
"name": "CSS Font rem Units",
"caniuse": "",X
"authors": ["nsfmc"],
"property": "cssremunit",
"tags": ["css"],
"notes": [{
"name": "W3C Spec",
"href": "http://www.w3.org/TR/css3-values/#relative0"
},{
"name": "Font Size with rem by Jonathan Snook",
"href": "http://snook.ca/archives/html_and_css/font-size-with-rem"
}]
}
!*/
define(['Modernizr', 'createElement'], function( Modernizr, createElement ) {
// test by github.com/nsfmc

// "The 'rem' unit ('root em') is relative to the computed
// value of the 'font-size' value of the root element."
// http://www.w3.org/TR/css3-values/#relative0
// you can test by checking if the prop was ditched

// http://snook.ca/archives/html_and_css/font-size-with-rem

Modernizr.addTest('cssremunit', function() {
var div = createElement('div');
try {
Expand Down
9 changes: 8 additions & 1 deletion feature-detects/css/scrollbars.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
/*!
{
"name": "CSS Stylable Scrollbars",
"caniuse": "",X
"property": "cssscrollbar",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testStyles', 'prefixes'], function( Modernizr, testStyles, prefixes ) {
// Stylable scrollbars detection
testStyles('#modernizr{overflow: scroll; width: 40px; height: 40px; }#' + prefixes
.join('scrollbar{width:0px}'+' #modernizr::')
.split('#')
Expand Down

0 comments on commit 205a098

Please sign in to comment.