HTML::O...aration(3)

πŸ“¦ version 0.6.0, in alpine 3.24

okay so bestie, welcome to the HTML::Object::DOM::Declaration(3) page β€” yes, the manual name is right there at the top, and this one comes from User Contributed Perl Documentation. We're doing DTD declaration content today, and it's lowkey iconic. πŸ’–

πŸ’– NAME πŸ’–

HTML::Object::DOM::Declaration β€” HTML Object DOM DTD

πŸŽ€ SYNOPSIS πŸŽ€

use HTML::Object::DOM::Declaration;
my $decl = HTML::Object::DOM::Declaration->new ||
    die( HTML::Object::DOM::Declaration->error, "\n" );

✨ VERSION ✨

v0.2.0 β€” that's the version, no cap.

πŸ¦‹ DESCRIPTION πŸ¦‹

This module implements an HTTML declaration for the DOM. It inherits from HTML::Object::Declaration and HTTML::Object::DOM::Node.

πŸ‘‘ INHERITANCE πŸ‘‘

the family tree is giving royal lineage, so here it is exactly:

           +---------------------------+     +---------------------------+     +-------------------------+     +--------------------------------+
           |   HTML::Object::Element   | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Declaration |
           +---------------------------+     +---------------------------+     +-------------------------+     +--------------------------------+
             |                                                                                                   ^
             |                                                                                                   |
             v                                                                                                   |
           +---------------------------+                                                                         |
           | HTML::Object::Declaration | ------------------------------------------------------------------------+
           +---------------------------+

🌸 PROPERTIES 🌸

Inherits properties from its parents HTML::Object::Declaration and HTML::Object::DOM::Node.

πŸ“ internalSubset

Read-only.

A string of the internal subset, or "undef" if there is none. Eg "<!ELEMENT foo (bar)>".

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/internalSubset

🧚 name

Read-only.

A string, eg "html" for <!DOCTYPE HTML>.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/name

πŸ¦‹ notations

Always returns "undef" under perl.

Normally, under JavaScript, this returns s "NamedNodeMap" with notations declared in the DTD.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/notations

πŸ’œ publicId

Read-only.

A string, eg "-//W3C//DTD HTML 4.01//EN", empty string for HTML5.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/publicId

🌈 systemId

Read-only.

A string, eg "http://www.w3.org/TR/html4/strict.dtd", empty string for HTML5.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/systemId

πŸ”₯ METHODS πŸ”₯

Inherits methods from its parents HTML::Object::Declaration and HTML::Object::DOM::Node.

⭐ after

Inserts a set of Node or string objects in the children list of the "DocumentType"'s parent, just after the "DocumentType" object.

Example:

my $docType = $doc->implementation->createDocumentType("html", "", "");
my $myDoc = $doc->implementation->createDocument("", "", $docType);

$docType->after($doc->createElement('html'));

$myDoc->childNodes;
# NodeList [<!DOCTYPE html>, <html>]

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/after

⭐ before

Inserts a set of Node or string objects in the children list of the "DocumentType"'s parent, just before the "DocumentType" object.

Example:

my $docType = $doc->implementation->createDocumentType("html", "", "");
my $myDoc = $doc->implementation->createDocument("", "", $docType);

$docType->before( $doc->createComment('<!--[if !IE]> conditional comment <![endif]-->') );

$myDoc->childNodes;
# NodeList [<!--[if !IE]> conditional comment <![endif]-->, <!DOCTYPE html>]

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/before

⭐ remove

Removes the object from its parent children list.

Example:

$doc->doctype; # "<!DOCTYPE html>'
$doc->doctype->remove();
$doc->doctype; # null

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/remove

⭐ replaceWith

Replaces the document type with a set of given nodes.

Example:

my $svg_dt = $doc->implementation->createDocumentType(
    'svg:svg',
    '-//W3C//DTD SVG 1.1//EN',
    'http://www->w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'
);

$doc->doctype->replaceWith($svg_dt);

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/replaceWith

⭐ string_value

Always returns "undef".

πŸ’… AUTHOR πŸ’…

Jacques Deguest (jack@deguest.jp) β€” iconic behavior, honestly.

🫢 SEE ALSO 🫢

Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/DocumentType

Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

okay, that's the whole page! Cute sign-off time: source/version perl v5.42.2, date 2026-02-15, and the footer's manual name is HTML::O...aration(3). Stay slaying, bestie. 🫢

πŸ“¦ where this page comes from