"input[value]" and ":input[value]" differ for <input> elements
by rwaldron
HTML
<input name="a">
<p></p>
JavaScript
var tests = [
{ selector: "input", expect: 1 },
{ selector: ":input", expect: 1 },
{ selector: "input[value]", expect: 0 },
{ selector: "input:not([value])", expect: 1 },
{ selector: ":input:not([value])", expect: 1 },
{ selector: ":input[value]", expect: 0 }
];
$.each( tests, function( i, test ) {
var actual = $(test.selector).length;
console.log(
(actual === test.expect && "PASS") || "FAIL",
test.selector, [ "expected: " + test.expect, "actual: " + actual ]
);
});