Dom\Element クラス

(PHP 8 >= 8.4.0)

はじめに

要素を表します。

このクラスは、DOMElement と同等ですが、 モダンかつ仕様に準拠しています。

クラス概要

class Dom\Element extends Dom\Node implements Dom\ParentNode, Dom\ChildNode {
/* 継承した定数 */
/* プロパティ */
public readonly ?string $namespaceURI;
public readonly ?string $prefix;
public readonly string $localName;
public readonly string $tagName;
public string $id;
public readonly Dom\TokenList $classList;
public readonly Dom\NamedNodeMap $attributes;
public readonly ?Dom\Element $lastElementChild;
public readonly int $childElementCount;
public readonly Dom\HTMLCollection $children;
/* 継承したプロパティ */
public readonly int $nodeType;
public readonly string $nodeName;
public readonly string $baseURI;
public readonly bool $isConnected;
public readonly ?Dom\Document $ownerDocument;
public readonly ?Dom\Node $parentNode;
public readonly ?Dom\Element $parentElement;
public readonly Dom\NodeList $childNodes;
public readonly ?Dom\Node $firstChild;
public readonly ?Dom\Node $lastChild;
public readonly ?Dom\Node $previousSibling;
public readonly ?Dom\Node $nextSibling;
/* メソッド */
/* Not documented yet */
/* 継承したメソッド */
/* Not documented yet */
}

プロパティ

namespaceURI

要素の名前空間 URI

prefix

要素の名前空間プレフィックス

localName

要素のローカル名

tagName

要素の大文字化されたHTML修飾名

className

スペースで分割された、要素のクラスを表す文字列

classList

この要素のクラスを簡単に管理するための、 Dom\TokenList を返します。

attributes

この要素の属性を表す Dom\NamedNodeMap のインスタンスを返します

id

"id" 属性を通して反映される要素のID

firstElementChild

最初の子要素。存在しない場合は null になります。

lastElementChild

最後の子要素。存在しない場合は null になります。

childElementCount

子要素の数。

previousElementSibling

前の兄弟要素。存在しない場合は null になります。

nextElementSibling

次の兄弟要素。存在しない場合は null になります。

children

このノードのすべての子要素を含む Dom\HTMLCollection。PHP 8.5.0 以降で利用可能です。

innerHTML

要素の inner HTML (またはXML文書のXML)

outerHTML

要素自身を含む、要素の outer HTML (またはXML文書のXML)。 PHP 8.5.0 以降で利用可能です。

substitutedNodeValue

エンティティ置換が有効になったノードの値

注意

注意:

DOM拡張モジュールは、メソッドやプロパティで UTF-8 エンコーディングを使います。 パースをおこなうメソッドは、エンコーディングを自動的に判別し、呼び出し側でエンコーディングを指定することもできます。

add a note

User Contributed Notes

There are no user contributed notes for this page.