Test case for jQuery Ticket 8009
:input / :not / [readonly]
by jitter
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<!--
After fixing several xhtml violations this works as expected
Fixed:
- input tags not wrapped in a block element
- closing of input tags was missing although required in xhtml
- there where two elements with the id Timestamp which is forbidden
- attribute minimization is not supported in xhtml thus the noly valid way to specify readonly on an element is readonly="readonly"
-->
<div>
<input type="hidden" name="pulsanteSubmit" />
<input type="button" id="refreshDatiProtocollo" />
<input type="hidden" id="numRecStorici" name="numRecStorici" value="4" class=" disabled" />
<input type="text" id="UtenteScrittura" name="UtenteScrittura" size="20" value="paolo" readonly="readonly" />
<input type="text" id="Timestamp" name="Timestamp" size="20" value="18/01/2011 19:59:08" class="dateITA" readonly="readonly" />
<input type="text" id="Timestamp2" name="Timestamp2" size="20" value="18/01/2011 19:59:08" class="dateITA" readonly="readonly" />
<input type="hidden" id="IDProtocollo" name="IDProtocollo" value="65060" class=" disabled" />
<input type="hidden" id="IDRegistroClassificatore" name="IDRegistroClassificatore" value="1" class=" disabled" />
<input type="hidden" id="AnnoClassificatore" name="AnnoClassificatore" value="2010" class=" disabled" />
<input type="text" id="Protocollo" name="Protocollo" size="12" value="999" class="digits" />
</div>
JavaScript
// Example:
// - 10 inputs
// - 3 readonly inputs
// - ERROR: in the not selector only 1 read only input excluded
console.log($(':input').length); // 10 inputs ok
console.log($('[readonly]').length); // OK
console.log($(':input:not([readonly])').length); // ERROR
console.log($(':input').not('[readonly]').length); // ERROR
// Revealed by not():
// - readonly="true"
// BUG: not revealed:
// - readonly
// - readonly=""