JSFiddle - React, Tailwind, and code Playground

HTML

<table border="1">
    <tr>
        <td style="height: 1em"></td>
    </tr>
    <tr>
        <td>
            Hello
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox">
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox">
            <img src="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
        </td>
    </tr>
</table>

JavaScript

// Select cells that don't have checkboxes
$('td:not(:has(:checkbox))').css({backgroundColor: 'yellow'});

// Select cells with checkboxes and non-checkbox elements too
$('td:has(:checkbox):has(:not(:checkbox))').css({backgroundColor: 'red'});

// Select cells with no non-checkbox things (fails)
// I would expect this to select the blank cell and the checkbox-only cell
//$('td:not(:has(:not(:checkbox)))').css({backgroundColor: 'blue'});

// Select cells with checkboxes and no non-checkbox things (fails)
// I would expect this to select only the checkbox-only cell
//$('td:has(:checkbox):not(:has(:not(:checkbox)))').css({backgroundColor: 'green'});

$('td:has(:checkbox)').not('td:has(:not(:checkbox))').css({backgroundColor: 'blue'});