Logical intent
Below is a breakdown of the CSS selectors originally posted in the question. This is an attempt to summarize how both CSS rules can be expressed using valid CSS (a discussion started by @thgaskell and @BoltClock). I'll leave the question of specificity to the other posters.
First rule
input:not([type="text"],[type="password"],.someClass) {}
This is a non-validating selector in CSS3, which might not be supported by any known browsers at present.
The logical intent of the selector is !(a or b or c)
, which is equivalent to !a and !b and !c
. For CSS selectors a logical and
operation requires chaining, which can be expressed as :not(a):not(b):not(c)
.
Thus the first rule can be expressed in valid CSS as follows:
input:not([type="text"]):not([type="password"]):not(.someClass) {}
Second rule
input:not(#someId[type="text"]) {}
This is a non-validating selector in CSS3, which might not be supported by any known browsers at present.
The logical intent of the selector is !(a and b)
, which is equivalent to !a or !b
. For CSS selectors a logical or
operation requires using multiple selectors (one selector for each operand), which can be expressed as :not(a), :not(b)
.
Thus the second rule can be expressed in valid CSS as follows:
input:not(#someId), input:not([type="text"]) {}
Summary
A logical and
operation requires chaining each operand.
.a.b {} /* Matches elements with both classes */
/* (a and b) */
:not(.a):not(.b) {} /* Matches elements with neither class */
/* (!a and !b) == !(a or b) */
A logical or
operation requires using multiple selectors (one selector for each operand).
.a, .b {} /* Matches elements with either class */
/* (a or b) */
:not(.a), :not(.b) {} /* Matches elements that don't have both classes */
/* (elements with none or only one of the classes) */
/* (aka: not both, nand, alternative denial */
/* (!a or !b) == !(a and b) */