Name

SPVM::Eg::Node::Document - Document(only XML document features) in JavaScript

Description

The Eg::Node::Document class in SPVM represents any XML/HTML page which is the DOM tree. This class itself is an abstruct class.

This class is a port of Document(only XML features) in JavaScript.

Usage

my $html_document = Eg->document->implementation->create_html_document("Title");

my $xml_document = Eg->document->implementation->create_document(
  "http://www.w3.org/1999/xhtml",
  "html",
);

Inheritance

Eg::Node

Fields

doctype

has doctype : ro protected Eg::Node::DocumentType;

The Document Type Declaration (DTD) associated with current document.

For details, see Document.doctype in JavaScript.

implementation

has implementation : ro Eg::DOM::Implementation;

An Eg::DOM::Implementation object associated with the current document.

For details, see Document.implementation in JavaScript.

Instance Methods

title

method title : string ();

Sets the current title of the document.

For details, see Document.title in JavaScript.

set_title

method set_title : string ($title : string);

Returns the current title of the document.

For details, see Document.title in JavaScript.

create_element

method create_element : Eg::Node::Element ($tag_name : string);

Creates the XML element specified by $tag_name.

For details, see Document.createElement in JavaScript.

create_text_node

method create_text_node : Eg::Node::Text ($node_value : string);

Creates and returns a new Text node.

For details, see Document.createTextNode in JavaScript.

create_comment

method create_comment : Eg::Node::Comment ($node_value : string);

Creates a new comment node, and returns it.

For details, see Document.createComment in JavaScript.

create_cdata_section

method create_cdata_section : Eg::Node::CDATASection ($node_value : string);

Creates a new CDATA section node, and returns it.

For details, see Document.createCDATASection in JavaScript.

create_document_fragment

method create_document_fragment : Eg::Node::DocumentFragment ();

Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.

For details, see Document.createDocumentFragment in JavaScript.

create_attribute

method create_attribute : Eg::Node::Attr ($name : string);

Creates a new attribute node, and returns it.

For details, see Document.createAttribute in JavaScript.

create_processing_instruction

method create_processing_instruction : Eg::Node::ProcessingInstruction ($target : string, $data : string);

Generates a new processing instruction node and returns it.

For details, see Document.createProcessingInstruction in JavaScript.

document_element

method document_element : Eg::Node::Element ();

Returns the element that is the root element of the document (for example, the <html> element for HTML documents).

For details, see Document.documentElement in JavaScript.

node_name

method node_name : string ();

Returns the node name.

For details, see Node.nodeName in JavaScript.

Well Known Child Classes

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License