-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: "CSSPseudoElement: element プロパティ" | ||
short-title: element | ||
slug: Web/API/CSSPseudoElement/element | ||
l10n: | ||
sourceCommit: d76defab4ca13261e9de81ae1df125345f847b0a | ||
--- | ||
|
||
{{APIRef}}{{SeeCompatTable}} | ||
|
||
**`element`** は {{DOMxRef('CSSPseudoElement')}} インターフェイスの読み取り専用のプロパティで、擬似要素の元要素、言い換えれば親要素への参照を返します。 | ||
|
||
## 値 | ||
|
||
この擬似要素の元要素を表す {{DOMxRef('Element')}} です。 | ||
|
||
## 例 | ||
|
||
下記の例は、 `CSSPseudoElement.element` と {{DOMxRef('Element.pseudo()')}} の関係を示しています。 | ||
|
||
```js | ||
const myElement = document.querySelector("q"); | ||
const cssPseudoElement = myElement.pseudo("::after"); | ||
const originatingElement = cssPseudoElement.element; | ||
|
||
console.log(myElement === originatingElement); // true を出力 | ||
console.log(myElement.parentElement === originatingElement); // false を出力 | ||
console.log(myElement.lastElementChild === cssPseudoElement); // false を出力 | ||
console.log(myElement.lastChild === cssPseudoElement); // false を出力 | ||
console.log(myElement.nextElementSibling === cssPseudoElement); // false を出力 | ||
console.log(myElement.nextSibling === cssPseudoElement); // false を出力 | ||
``` | ||
|
||
## 仕様書 | ||
|
||
{{Specifications}} | ||
|
||
## ブラウザーの互換性 | ||
|
||
{{Compat}} | ||
|
||
## 関連情報 | ||
|
||
- {{DOMxRef('Element.pseudo()')}} |