Skip to content
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

Add feature detect for checked pseudo selector #879

Merged
merged 4 commits into from Mar 27, 2013
Merged

Add feature detect for checked pseudo selector #879

merged 4 commits into from Mar 27, 2013

Conversation

@vpegado
Copy link
Contributor

@vpegado vpegado commented Mar 26, 2013

When using input elements to store the state of your css classes it is very useful to know if you can use the feature or not.

@stucox
Copy link
Member

@stucox stucox commented Mar 26, 2013

Duplicate of #767 - could you comment on differences between the two implementations?

@vpegado
Copy link
Contributor Author

@vpegado vpegado commented Mar 26, 2013

I couldn't find #767 when looking for this feature test.
The only differences are:

  • in testStyles() #767 uses 2 unnecessary nodes while this don't.
  • in testStyles() #767 checks the value of elem.lastChild.offsetLeft while this checks the appended element directly with cb.offsetWidth

Except for implementation details the tests are equivalent.

!*/
define(['Modernizr', 'createElement', 'testStyles'], function( Modernizr, createElement, testStyles ) {
Modernizr.addTest('checked', function(){
return Modernizr.testStyles('#modernizr input {width:100px} #modernizr :checked {width:200px;display:block}', function(elem, rule){

This comment has been minimized.

@stucox

stucox Mar 26, 2013
Member

Don't need Modernizr. here, can just use return testStyles(... because it's being passed into the module as a dependency

define(['Modernizr', 'createElement', 'testStyles'], function( Modernizr, createElement, testStyles ) {
Modernizr.addTest('checked', function(){
return Modernizr.testStyles('#modernizr input {width:100px} #modernizr :checked {width:200px;display:block}', function(elem, rule){
var cb = document.createElement('input');

This comment has been minimized.

@stucox

stucox Mar 26, 2013
Member

Don't need document. here - as above.

@stucox
Copy link
Member

@stucox stucox commented Mar 27, 2013

Great, thanks!

stucox pushed a commit that referenced this pull request Mar 27, 2013
Stu Cox
Add feature detect for checked pseudo selector
@stucox stucox merged commit af5f597 into Modernizr:master Mar 27, 2013
1 check passed
1 check passed
default The Travis build passed
Details
@adrianjacob-o2
Copy link

@adrianjacob-o2 adrianjacob-o2 commented Jan 7, 2014

Why cant i see css-checked in the custom build options?

@patrickkettner
Copy link
Member

@patrickkettner patrickkettner commented Jan 7, 2014

It is in master, which is 3.0. It hasn't been added to the 2.7 branch
because it is not a bug fix, but rather a new feature.

If you need it, you will either need to manually edit your modernizr, or
download this repo, and build it yourself.

really sorry for the inconvenience :/

On Tue, Jan 7, 2014 at 10:14 AM, adrianjacob-o2 notifications@github.comwrote:

Why cant i see css-checked in the custom build options?


Reply to this email directly or view it on GitHubhttps://github.com//pull/879#issuecomment-31745326
.

patrick

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this pull request Feb 22, 2015
Add feature detect for checked pseudo selector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants