Web::DOM::Document
DOM Document
object
DESCRIPTION
The Web::DOM::Document
class implements the DOM Document
interface,
which represents an HTML or XML document.
METHODS
In addition to the methods of classes Web::DOM::EventTarget, Web::DOM::Node, Web::DOM::ParentNode, and Web::DOM::XPathEvaluator, following methods are available:
$doc = new Web::DOM::Document
-
Create a new document object. [DOM]
$node = $doc->adopt_node ($node)
-
Change the node document (i.e. the
owner_document
attribute value) of the specified node and its descendant nodes to the document. [DOM] [HTML] $bool = $doc->all_declarations_processed
$doc->all_declarations_processed ($bool)
-
Return or set the [all declarations processed] property value of the document. [MANAKAI]
$el = $doc->atom_feed_element
-
Return the document element, if it is the
atom:feed
element. [ATOMDOM] $el = $doc->body
$doc->body ($el)
-
Return or set the body element of the document (i.e. the
body
element or theframeset
element). [HTML] $string = $doc->character_set
$string = $doc->input_encoding
$string = $doc->charset
$doc->input_encoding ($string)
-
Return or set the canonical encoding label of the document. [DOM] [MANAKAI]
$string = $doc->manakai_charset
$doc->manakai_charset ($string)
-
Return or set the
charset
parameter value of theContent-Type
metadata, if any. [MANAKAI] $string = $doc->compat_mode
-
Return
BackComat
if the document is in the quirks mode, orCSS1Compat
otherwise. [DOM] $string = $doc->manakai_compat_mode
$doc->manakai_compat_mode ($string)
-
Get or set the mode of the document. The value can be one of:
no quirks
,limited quirks
, andquirks
. [MANAKAI] $string = $doc->content_type
-
Return the MIME type of the document. [DOM]
$attr = $doc->create_attribute ($local_name)
-
Create a new attribute (Web::DOM::Attr) with the specified name and empty value. [DOM]
$attr = $doc->create_attribute_ns ($nsurl, $qname)
$attr = $doc->create_attribute_ns ($nsurl, [$prefix, $local_name])
-
Create a new attribute (Web::DOM::Attr) with the specified namespace URL and qualified name. [DOM]
The qualified name can be represented as an array reference, where the first item is the prefix (or
undef
for the null namespace) and the second item is the local name. [DOMPERL] $adef = $doc->create_attribute_definition ($name)
-
Create an attribute definition (Web::DOM::AttributeDefinition) with the specified name. [DOMDTDEF]
$doc->create_cdata_section ($text)
-
Throw a "NotSupportedError" exception. The
CDATASection
interface is obsolete. [MANAKAI] $comment = $doc->create_comment ($data)
$comment = $doc->create_comment (\$data)
-
Create a new comment (Web::DOM::Comment) with the specified data. [DOM]
$dt = $doc->create_document_type_definition ($name)
-
Create a new document type (Web::DOM::DocumentType) with the specified name. [DOMDTDEF]
$el = $doc->create_element ($local_name)
-
Create a new element (Web::DOM::HTMLElement) with the specified local name (in the HTML namespace if the document is an HTML or XHTML document, or in the null namespace otherwise). [DOM] [HTML] [MANAKAI]
$el = $doc->create_element_ns ($nsurl, $qname)
$el = $doc->create_element_ns ($nsurl, [$prefix, $local_name])
-
Create a new element (Web::DOM::Element) with specified namespace URL and qualified name. [DOM] [HTML] [MANAKAI]
The qualified name can be represented as an array reference, where the first item is the prefix (or
undef
for the null namespace) and the second item is the local name. [DOMPERL] $et = $doc->create_element_type_definition ($name)
-
Create a new element type definition (Web::DOM::ElementTypeDefinition) with the specified name. [DOMDTDEF]
$doc->create_entity_reference ($name)
-
Throw a "NotSupportedError" exception. The
EntityReference
interface is obsolete. [MANAKAI] $ev = $doc->create_event ($interface)
-
Create an event object. The argument specifies the kind of the object, e.g.
Event
,CustomEvent
, orMouseEvent
. [DOM]This method is considered as legacy. Use Web::DOM::Event's (or its subclass'es)
new
method instead. $ent = $doc->create_general_entity ($name)
-
Create a general entity (Web::DOM::Entity) with the specified name. [DOMDTDEF]
$ni = $doc->create_node_iterator ($root, $what_to_show, $filter)
-
Create a new node iterator (Web::DOM::NodeIterator). [DOM]
The first argument is required, specifying the root node of the iterator. Second and third arguments are optional, representing bit vector of node types and code reference, both used to filter candidate nodes. For the bit vector, see "CONSTANTS" in Web::DOM::TreeWalker. The code reference would be invoked with an argument (
$_[1]
) which is the node in question. The code is expected to return whether the node is accepted or not, using one of constants from "CONSTANTS" in Web::DOM::TreeWalker. $notation = $doc->create_notation ($name)
-
Create a notatioon (Web::DOM::Notation) with the specified name. [DOMDTDEF]
$text = $doc->create_text_node ($data)
$text = $doc->create_text_node (\$data)
-
Create a new text node (Web::DOM::Text) with the given character string. [DOM]
$touch = $doc->create_touch ($view, $target, $identifier, $page_x, $page_y, $screen_x, $screen_y)
-
Create a new Web::DOM::Touch with the specified arguments. [TOUCH]
$list = $doc->create_touch_list ($touch1, $touch2, ...)
-
Create a new Web::DOM::TouchList with the specified Web::DOM::Touches. [TOUCH]
$tw = $doc->create_tree_walker ($root, $what_to_show, $filter)
-
Create a new tree walker (Web::DOM::TreeWalker). [DOM]
The first argument is required, specifying the root node of the tree walker. Second and third arguments are optional, representing bit vector of node types and code reference, both used to filter candidate nodes. For the bit vector, see "CONSTANTS" in Web::DOM::TreeWalker. The code reference would be invoked with an argument (
$_[1]
) which is the node in question. The code is expected to return whether the node is accepted, rejected, or skipped, using one of constants from "CONSTANTS" in Web::DOM::TreeWalker. $pi = $doc->create_processing_instruction ($target, $data)
-
Create a new processing instruction node (Web::DOM::ProcessingInstruction) with the specified target and data. [DOM] [MANAKAI]
$text = $doc->dir
$doc->dir ($text)
-
Return or set the
dir
attribute of thehtml
element, if any. [HTML] $dt = $doc->doctype
-
Return the Web::DOM::DocumentType node of the document, if any. [DOM]
$el = $doc->document_element
-
Return the document element of the document, if any. [DOM]
$config = $doc->dom_config
-
Return the Web::DOM::Configuration object for the document. [DOM3CORE] [MANAKAI]
$col = $doc->embeds
$col = $doc->plugins
-
Return the Web::DOM::HTMLCollection object containing the
embed
elements in the document. [HTML] $string = $doc->manakai_entity_base_uri
$doc->manakai_entity_base_uri ($string)
-
Return or set the base URL of the document entity (not of the document). [DOMDTDEF]
See also "DEPENDENCY" in Web::DOM.
$col = $doc->forms
-
Return the Web::DOM::HTMLCollection object containing the
form
elements in the document. [HTML] $el = $doc->get_element_by_id ($id)
-
Return the element whose ID is equal to the argument, if any, or
undef
. [DOM] $col = $doc->get_elements_by_name ($name)
-
Return the Web::DOM::NodeList containing the elements whose
name
is equal to the specified value. [HTML] [MANAKAI] $bool = $doc->manakai_has_bom
$doc->manakai_has_bom ($bool)
-
Return or set whether the byte representation of the document has the BOM or not. [MANAKAI]
$el = $doc->head
$el = $doc->manakai_head [DEPRECATED]
-
Return the
head
element of the document, if any, orundef
. [HTML] [MANAKAI] $el = $doc->manakai_html
-
Return the
html
element of the document, if any, orundef
. [MANAKAI] $col = $doc->images
-
Return the Web::DOM::HTMLCollection object containing the
img
elements in the document. [HTML] $impl = $doc->implementation
-
Return the Web::DOM::Implementation object associated to the document. [DOM]
$node2 = $doc->import_node ($node1, $deep)
-
Return the newly-created clone of the specified node, belonging to the document. If the second argument is set to the true value, any descendant nodes are also cloned. [DOM] [DOMATTREXODUS] [HTML] [MANAKAI]
$bool = $doc->manakai_is_html
$doc->manakai_is_html ($bool)
-
Return or set whether the document is an HTML document or not. [MANAKAI]
$bool = $doc->manakai_is_srcdoc
$doc->manakai_is_srcdoc ($bool)
-
Return or set whether the document is an
iframe
srcdoc
document or not. [MANAKAI] $doc->manakai_set_url ($string)
-
Set the document's address. [MANAKAI]
See also "DEPENDENCY" in Web::DOM.
$col = $doc->links
-
Return the Web::DOM::HTMLCollection object containing the HTML
a
orarea
elements with thehref
attribute in the document. [HTML] $col = $doc->scripts
-
Return the Web::DOM::HTMLCollection object containing the HTML
script
elements in the document. [HTML] $bool = $doc->strict_error_checking
$doc->strict_error_checking ($bool)
-
Return or set whether some error checks should be skipped or not. [DOM3CORE] [MANAKAI]
$string = $doc->title
$doc->title ($string)
$string = $doc->url
$string = $doc->document_uri
-
Return the URL of the document (or the document's address). [DOM] [HTML]
$string = $doc->xml_encoding
$doc->xml_encoding ($string)
-
Return or set the
encoding
pseudo-attribute value of the XML declaration of the document, if it is an XML document. Theundef
value represents omission of the pseudo-attribute. [DOM3CORE] [MANAKAI] $bool = $doc->xml_standalone
$doc->xml_standalone ($bool)
-
Return or set the
standalone
pseudo-attribute value of the XML declaration of the document, if it is an XML document. The true value represents thetrue
attribute value, while the false value represents thefalse
attribute value. [DOM3CORE] $string = $doc->xml_version
$doc->xml_version ($string)
-
Return or set the XML version of the document. The value must be
1.0
or1.1
. This is the value of theversion
pseudo-attribute of the XML declaration of the document, if it is an XML document. [DOM3CORE]
Additionally,
the following obsolete methods are available: all
,
anchors
,
applets
,
and clear
. [HTML]
SPECIFICATIONS
- DOM
-
DOM Standard
<https://dom.spec.whatwg.org/#interface-document>
. - DOMATTREXODUS
-
DOM Standard
<view-source:https://dom.spec.whatwg.org/>
. - DOM3CORE
-
Document Object Model (DOM) Level 3 Core Specification
<https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html>
. - HTML
-
HTML Standard
<https://www.whatwg.org/specs/web-apps/current-work/>
. - SVG
-
SVG
<https://svgwg.org/svg2-draft/single-page.html#struct-InterfaceSVGDocument>
. - TOUCH
-
Touch Events
<https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html>
. - DOMDTDEF
-
DOM Document Type Definitions
<https://suika.suikawiki.org/www/markup/xml/domdtdef/domdtdef>
. - ATOMDOM
-
Atom DOM
<https://suika.suikawiki.org/www/markup/xml/atomdom>
. - DOMXPATH
-
Document Object Model XPath
<https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator>
. - DOMPERL
-
manakai's DOM Perl Binding
<https://suika.suikawiki.org/~wakaba/wiki/sw/n/manakai%27s%20DOM%20Perl%20Binding>
. - MANAKAI
-
manakai DOM Extensions
<https://suika.suikawiki.org/~wakaba/wiki/sw/n/manakai++DOM%20Extensions>
.
SEE ALSO
AUTHOR
Wakaba <wakaba@suikawiki.org>.
LICENSE
Copyright 2012-2016 Wakaba <wakaba@suikawiki.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.