-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CSS.supports() internally (fixes #818) #933
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8bb7e94
Modify CSS Exclusions to CSS Shapes, since we split up the specificat…
zhorvath 7c1a6d7
Modify CSS Exclusions to CSS Shapes, since we split up the specificat…
zhorvath 45122e1
Shape-inside's computed style now returns 6 parameters, since it incl…
zhorvath 380fefd
Merge pull request #998 from zhorvath/master
f94f86a
Merge pull request #980 from zhorvath/updaterefs
8cc5f1c
Merge branch 'master' of https://github.com/Modernizr/Modernizr
stucox e42aa9f
Squashed commit of the following:
stucox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
define(function() { | ||
// Helper function for e.g. boxSizing -> box-sizing | ||
function domToHyphenated( name ) { | ||
return name.replace(/([A-Z])/g, function(str, m1) { | ||
return '-' + m1.toLowerCase(); | ||
}).replace(/^ms-/, '-ms-'); | ||
} | ||
return domToHyphenated; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
define(['injectElementWithStyles', 'domToHyphenated'], function ( injectElementWithStyles, domToHyphenated ) { | ||
// Function to allow us to use native feature detection functionality if available. | ||
// Accepts a list of property names and a single value | ||
// Returns `undefined` if native detection not available | ||
function nativeTestProps ( props, value ) { | ||
var i = props.length; | ||
// Start with the JS API: http://www.w3.org/TR/css3-conditional/#the-css-interface | ||
if ('CSS' in window && 'supports' in window.CSS) { | ||
// Try every prefixed variant of the property | ||
while (i--) { | ||
if (window.CSS.supports(domToHyphenated(props[i]), value)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
// Otherwise fall back to at-rule (for FF 17 and Opera 12.x) | ||
else if ('CSSSupportsRule' in window) { | ||
// Build a condition string for every prefixed variant | ||
var conditionText = []; | ||
while (i--) { | ||
conditionText.push('(' + domToHyphenated(props[i]) + ':' + value + ')'); | ||
} | ||
conditionText = conditionText.join(' or '); | ||
return injectElementWithStyles('@supports (' + conditionText + ') { #modernizr { position: absolute; } }', function( node ) { | ||
return (window.getComputedStyle ? | ||
getComputedStyle(node, null) : | ||
node.currentStyle)['position'] == 'absolute'; | ||
}); | ||
} | ||
return undefined; | ||
} | ||
return nativeTestProps; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
define(['ModernizrProto', 'testPropsAll'], function( ModernizrProto, testPropsAll ) { | ||
var testAllProps = ModernizrProto.testAllProps = testPropsAll; | ||
return testAllProps; | ||
/** | ||
* testAllProps determines whether a given CSS property, in some prefixed | ||
* form, is supported by the browser. It can optionally be given a value; in | ||
* which case testAllProps will only return true if the browser supports that | ||
* value for the named property; this latter case will use native detection | ||
* (via window.CSS.supports) if available. A boolean can be passed as a 3rd | ||
* parameter to | ||
* | ||
* @param prop - String naming the property to test | ||
* @param value - [optional] String of the value to test | ||
* @param skipValueTest - [optional] Whether to skip testing that the value | ||
* is supported when using non-native detection | ||
* (default: false) | ||
*/ | ||
function testAllProps (prop, value, skipValueTest) { | ||
return testPropsAll(prop, undefined, undefined, value, skipValueTest); | ||
} | ||
ModernizrProto.testAllProps = testAllProps; | ||
return testAllProps; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
define(['ModernizrProto', 'testProps'], function( ModernizrProto, testProps ) { | ||
define(['ModernizrProto', 'testProps', 'is'], function( ModernizrProto, testProps, is ) { | ||
// Modernizr.testProp() investigates whether a given style property is recognized | ||
// Note that the property names must be provided in the camelCase variant. | ||
// Modernizr.testProp('pointerEvents') | ||
var testProp = ModernizrProto.testProp = function( prop ) { | ||
return testProps([prop]); | ||
// Also accepts optional 2nd arg, of a value to use for native feature detection, e.g.: | ||
// Modernizr.testProp('pointerEvents', 'none') | ||
var testProp = ModernizrProto.testProp = function( prop, value, useValue ) { | ||
return testProps([prop], undefined, value, useValue); | ||
}; | ||
return testProp; | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the end of the sentence seems missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! I'll finish that off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated: https://github.com/Modernizr/Modernizr/blob/master/src/testAllProps.js