1 line
2.1 KiB
JSON
1 line
2.1 KiB
JSON
{"name":"lang","type":"selector","title":":lang() Selector","deprecated":null,"removed":null,"desc":"Selects all elements of the specified language.","categories":["selectors/basic-filter-selectors","version/1.9"],"entries":[{"return":"","signatures":{"added":"1.9","argument":{"desc":"A language code.","name":"language","type":"String"}},"examples":{"desc":"Color div elements according to their language.","code":"\n$( \"div:lang(en-us)\" ).addClass( \"usa\" );\n$( \"div:lang(es-es)\" ).addClass( \"spain\" );\n","html":"\n<h3>USA</h3>\n<div lang=\"en-us\">red\n <div>white\n <div>and blue</div>\n </div>\n</div>\n<h3>España</h3>\n<div lang=\"es-es\">rojo\n <div>amarillo\n <div>y rojo</div>\n </div>\n</div>\n","css":"\n body {\n background-color: #ccc;\n }\n h3 {\n margin: .25em 0;\n }\n div {\n line-height: 1.5em\n }\n .usa {\n background-color: #f00;\n color: #fff;\n }\n .usa .usa {\n background-color: #fff;\n color: #000;\n }\n .usa .usa .usa {\n background-color: #00f;\n color: #fff;\n }\n .spain {\n background-color: #f00;\n color: #ff0;\n }\n .spain .spain {\n background-color: #ff0;\n color: #f00;\n line-height: 3em;\n }\n .spain .spain .spain {\n background-color: #f00;\n color: #ff0;\n line-height: 1.5em;\n }\n"},"longdesc":"\n <p>The <code>:lang()</code> selector matches elements that have a language value equal to the supplied language code or that start with the supplied language code immediately followed by \"-\". For example, the selector <code>$(\"div:lang(en)\")</code>will match <code><div lang=\"en\"></code> and <code><div lang=\"en-us\"></code> (and any of their descendant <code><div></code>s), but not <code><div lang=\"fr\"></code></p>\n <p>For HTML elements, the language value is determined by the <code>lang</code> attribute and possibly information from <code>meta</code> elements or HTTP headers.</p>\n <p>Further discussion of this usage can be found in the <a href=\"http://www.w3.org/TR/css3-selectors/#lang-pseudo\">W3C CSS specification</a>.</p>\n "}],"slug":"lang-selector"} |