The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::Object::DOM::Element::Title - HTML Object DOM Title Class

SYNOPSIS

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

VERSION

    v0.2.1

DESCRIPTION

This interface contains the title for a document. This element inherits all of the properties and methods of the HTML::Object::DOM::Element interface.

INHERITANCE

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

PROPERTIES

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

text

Is a string representing the text of the document's title, and only the text part. For example, consider this:

    <!doctype html>
    <html>
        <head>
            <title>Hello world! <span class="highlight">Isn't this wonderful</span> really?</title>
        </head>
        <body></body>
    </html>

    my $title = $doc->getElementsByTagName( 'title' )->[0];
    say $title->text;
    # Hello world!  really?

As you can see, the tag span and its content was skipped.

Also, do not confuse:

    $doc->title;

with:

    $doc->getElementsByTagName( 'title' )->[0];

The former is just a setter/getter method to set or get the inner text value of the document title, while the latter is the HTML::Object::DOM::Element::Title object. So you cannot write:

    $doc->title->text = "Hello world!";

See also Mozilla documentation

METHODS

Inherits methods from its parent HTML::Object::DOM::Element

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Mozilla documentation, Mozilla documentation on title element

COPYRIGHT & LICENSE

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.