1 line
1.2 KiB
JSON
1 line
1.2 KiB
JSON
{"name":"empty","type":"selector","title":":empty Selector","deprecated":null,"removed":null,"desc":"Select all elements that have no children (including text nodes).","categories":["selectors/content-filter-selector","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0"},"examples":{"desc":"Finds all elements that are empty - they don't have child elements or text.","code":"\n$( \"td:empty\" )\n .text( \"Was empty!\" )\n .css( \"background\", \"rgb(255,220,200)\" );\n","css":"\n td {\n text-align: center;\n }\n","html":"\n<table border=\"1\">\n <tr><td>TD #0</td><td></td></tr>\n <tr><td>TD #2</td><td></td></tr>\n <tr><td></td><td>TD#5</td></tr>\n</table>\n"},"longdesc":"\n <p>This is the inverse of <code>:parent</code>. </p>\n <p>One important thing to note with :empty (and :parent) is that child elements include text nodes.</p>\n <p>The W3C recommends that the <code><p></code> element have at least one child node, even if that child is merely text (see http://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.</p>\n "}],"slug":"empty-selector"} |