:root
:rootはHTMLのルート要素を指定できるセレクタです。
次のスクリプトではJavaScriptがonの環境のみルート要素であるhtml要素にjsというclassを追加しています。
$(":root").addClass("js");
ほとんどの場合においてroot疑似クラスはhtml要素を指し示します。
jQuery 1.9.0での追加/変更:rootはCSS3で定義されているセレクタのためCSS3対応ブラウザでは古いバージョンのjQueryから利用できますが、jQuery 1.9.0でjQueryのSizzleエンジンに追加されCSS3未対応ブラウザでも利用可能になりました。参考URL
:root Selector | jQuery API Documentation
登録日 : 2013年01月19日 最終更新日 : 2013年1月19日
同じカテゴリー(Selectors)のエントリー
- :disabled
- [attribute~=’value’]
- [attribute|=’value’]
- :animated
- :focus
- :target
- :lang()
- :root
- :only-of-type
- :last-of-type
- :first-of-type
- :nth-last-of-type()
- :nth-of-type()
- :nth-last-child()
- :selected
- :checked
- :file
- :button
- :reset
- :image
- :submit
- :checkbox
- :radio
- :password
- :text
- :input
- :parent
- :has()
- :contains()
- :header
- :lt()
- :gt()
- :eq()
- :odd
- :even
- :last
- :first
- [attributeFilter1][attributeFilter2]
- [attribute*=’value’]
- [attribute$=’value’]
- [attribute^=’value’]
- [attribute!=’value’]
- [attribute=’value’]
- [attribute]
- :not()
- :empty
- :only-child
- :last-child
- :first-child
- 兄弟セレクタ
- 隣接セレクタ
- 子セレクタ
- 子孫セレクタ
- グループセレクタ
- classセレクタ
- idセレクタ
- 要素セレクタ
- ユニバーサルセレクタ