HTML::O...t::Body(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’– HTML::Object::DOM::Element::Body β€” bestie edition πŸ’–

okay so this page is all about HTML::Object::DOM::Element::Body, the HTML Object DOM Body Class 🫢 (yes, it's Perl, yes it's a DOM, yes we're doing this).

✨ SYNOPSIS ✨

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

like, that's literally it. new it or die trying, no cap πŸ’…

🌸 VERSION 🌸

v0.2.0

πŸ¦‹ INHERITANCE πŸ¦‹

so the whole family tree goes like this, and honestly the way that chain ate:

+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +----------------------------------+
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Body |
+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +----------------------------------+

✨ DESCRIPTION ✨

The HTML::Object::DOM::Element::Body interface is here to serve πŸŽ€ β€” it gives you special properties (like, on top of the ones it already inherits from the regular HTML::Object::DOM::Element interface) for manipulating <body> elements. that's the whole vibe. body stuff. iconic.


πŸ‘‘ PROPERTIES πŸ‘‘

Inherits properties from its parent HTML::Object::DOM::Element. periodt.

πŸ’€ OBSOLETE PROPERTIES πŸ’€

ngl bestie, these are deprecated β€” and all of them literally just return undef πŸ’€
  • aLink β€” a string representing the color of active hyperlinks. iykyk.
  • background β€” a string representing the description of the location of the background image resource. ⚠️ heads up: this is not an URI, though some older version of some browsers do expect it. (yes, fr fr, that's the actual caveat.)
  • bgColor β€” a string representing the background color for the document.
  • link β€” a string representing the color of unvisited links.
  • text β€” a string representing the foreground color of text.
  • vLink β€” a string representing the color of visited links.

and each one has its own Mozilla documentation link, because of course:

🌈 METHODS 🌈

Inherits methods from its parent HTML::Object::DOM::Element. that's the tea πŸ“


πŸ”₯ EVENT HANDLERS πŸ”₯

Below are the event handlers you can use that are implemented in this interface. BUT β€” and this is the important part, bestie β€” it is up to you to fire those related events. the library is not gonna do it for you, no cap πŸ™ˆ

πŸ’œ onafterprint

Is an event handler representing the code to be called when the afterprint event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint>

πŸ’œ onbeforeprint

Is an event handler representing the code to be called when the beforeprint event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeprint>

πŸ’œ onbeforeunload

Is an event handler representing the code to be called when the beforeunload event is raised.

Example, slay:

use HTML::Object::DOM qw( window );
window->addEventListener( beforeunload => sub
{
    # Cancel the event
    # If you prevent default behavior in Mozilla Firefox prompt will always be shown
    $e->preventDefault();
    # Chrome requires returnValue to be set
    $e->returnValue = '';
});

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload>

πŸ’œ onhashchange

Is an event handler representing the code to be called when the hashchange event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onhashchange>

πŸ’œ onlanguagechange

Is an event handler representing the code to be called when the languagechange event is raised.

Example:

object->onlanguagechange = function;

window->onlanguagechange = sub
{
    say( 'languagechange event detected!' );
};

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onlanguagechange>

πŸ’œ onmessage

Is an event handler called whenever an object receives a message event.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onmessage>

πŸ’œ onmessageerror

Is an event handler called whenever an object receives a messageerror event.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onmessageerror>

πŸ’œ onoffline

Is an event handler representing the code to be called when the offline event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/onoffline>

πŸ’œ ononline

Is an event handler representing the code to be called when the online event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ononline>

πŸ’œ onpagehide

Is an event handler representing the code to be called when the pagehide event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/onpagehide>

πŸ’œ onpageshow

Is an event handler representing the code to be called when the pageshow event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/onpageshow>

πŸ’œ onpopstate

Is an event handler representing the code to be called when the popstate event is raised.

Example β€” this one's a whole mini saga, bestie:

window->onpopstate = sub
{
    my $event = shift( @_ );
    say( "location: " . $doc->location . ", state: " . JSON->new->encode( $event->state ) );
};

$history->pushState({page => 1}, "title 1", "?page=1");
$history->pushState({page => 2}, "title 2", "?page=2");
$history->replaceState({page => 3}, "title 3", "?page=3");
$history->back(); # alerts "location: https://example.org/example.html?page=1, state => {"page" => 1}"
$history->back(); # alerts "location: https://example.org/example.html, state: null
$history->go(2);    # alerts "location: https://example.org/example.html?page=3, state => {"page" =>3}

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate>

πŸ’œ onrejectionhandled

An event handler representing the code executed when the rejectionhandled event is raised, indicating that a Promise was rejected and the rejection has been handled. 😌 closure, we love to see it.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onrejectionhandled>

πŸ’œ onresize

Is an event handler representing the code to be called when the resize event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onresize>

πŸ’œ onstorage

Is an event handler representing the code to be called when the storage event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onstorage>

πŸ’œ onunhandledrejection

An event handler representing the code executed when the unhandledrejection event is raised, indicating that a Promise was rejected but the rejection was not handled. 😭 the drama of it all.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunhandledrejection>

πŸ’œ onunload

Is an event handler representing the code to be called when the unload event is raised.

See also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunload>


πŸŽ€ AUTHOR πŸŽ€

Jacques Deguest <jack@deguest.jp> β€” king behavior, honestly πŸ‘‘

🧚 SEE ALSO 🧚

Copyright(c) 2022 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.


and that's the page, bestie πŸ’– this doc shipped as perl v5.42.2, dated 2026-02-15, and yes we're crediting the perl manpage family for the whole HTML::O...t::Body(3) glow-up. go forth and manipulate those <body> elements πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from