Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added 'first-child' pseudo-selector test. #717

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant
@ghost

ghost commented Sep 28, 2012

This is pretty much just an small rewrite of the 'css-lastchild.js' feature test already present on Modernizr to allow for the detection of browser support for the :first-child pseudo-selector. I am pretty sure that every browser that supports :last-child also supports :first-child (and vice-versa), and as such including this may sound a bit redundant, but if I am using :first-child anywhere I'd rather write

.firstchild {
    /* (...) */
}
.no-firstchild {
    /* (...) */
}

than .lastchild and .no-lastchild.

Build Status

@sindresorhus sindresorhus commented on an outdated diff Sep 28, 2012

feature-detects/css-firstchild.js
@@ -0,0 +1,7 @@
+// 'first-child' pseudo-selector test.
+
+Modernizr.addTest('firstchild', function(){
@sindresorhus

sindresorhus Sep 28, 2012

Member

function() {

@sindresorhus sindresorhus commented on an outdated diff Sep 28, 2012

feature-detects/css-firstchild.js
@@ -0,0 +1,7 @@
+// 'first-child' pseudo-selector test.
+
+Modernizr.addTest('firstchild', function(){
+ return Modernizr.testStyles("#modernizr div {width:100px} #modernizr :first-child {width:200px;display:block}", function (elem) {
@sindresorhus

sindresorhus Sep 28, 2012

Member

function(elem) {

@ghost

ghost commented Sep 28, 2012

@sindresorhus: Had passed really unnoticed. :-) Fixed. Thank you very much.

@ghost

ghost commented Nov 29, 2012

@KuraFire, @paulirish: Any chances this might get merged?

@ghost ghost closed this May 10, 2013

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment