HTML-Object

 view release on metacpan or  search on metacpan

lib/HTML/Object/DOM/Element.pm  view on Meta::CPAN


A boolean value that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them.

See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/spellcheck> for more information.

=head2 style

This does nothing, but return a new empty L<hash object|Module::Generic::Hash>

Normally, this would set or get A C<CSSStyleDeclaration> representing the declarations of the element's style attribute.

See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style> for more information.

=head2 tabIndex

The tabIndex property represents the tab order of the current element.

Tab order is as follows:

=over

=item 1. Elements with a positive tabIndex. Elements that have identical tabIndex values should be navigated in the order they appear. Navigation proceeds from the lowest tabIndex to the highest tabIndex.

=item 2. Elements that do not support the tabIndex attribute or support it and assign tabIndex to 0, in the order they appear.

=back

Elements that are disabled do not participate in the tabbing order.

Values do not need to be sequential, nor must they begin with any particular value. They may even be negative, though each browser trims very large values.

See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex>

=head2 tagName

Read-only. This is merely an alias for L</getName>

This returns a string with the name of the tag for the given element.

See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName>

=head2 textContent

This returns or sets the textual content of an element and all its descendants.

Example:

    <div id="divA">This is <span>some</span> text!</div>

    my $text = $doc->getElementById('divA')->textContent;
    # The text variable is now: 'This is some text!'

    $doc->getElementById('divA')->textContent = 'This text is different!';
    # The HTML for divA is now:
    # <div id="divA">This text is different!</div>

See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent>

=head2 title

A string containing the text that appears in a popup box when mouse is over the element.

See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/title> for more information.

=head2 translate

A boolean value representing the translation.

See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/translate> for more information.

=head1 METHODS

=head2 addEventListener

Registers an event handler to a specific event type on the element. This is inherited from L<HTML::Object::EventTarget>

See L<HTML::Object::EventTarget/addEventListener> for more information.

=head2 after

Inserts a list of L<element|HTML::Object::Element> or HTML string in the L<children|/children> list of the L<element|HTML::Object::Element>'s parent, just after the L<element|HTML::Object::Element>.

For example:

Inserting an element:

    my $container = $doc->createElement("div");
    my $p = $doc->createElement("p");
    $container->appendChild( $p );
    my $span = $doc->createElement("span");

    $p->after( $span );

    say( $container->outerHTML );
    # "<div><p></p><span></span></div>"

Inserting an element and text

    my $container = $doc->createElement("div");
    my $p = $doc->createElement("p");
    $container->appendChild( $p );
    my $span = $doc->createElement("span");

    $p->after( $span, "Text" );

    say( $container->outerHTML );
    # "<div><p></p><span></span>Text</div>"

See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Element/after>

=for Pod::Coverage ajax

=head2 append

Inserts a set of L<element|HTML::Object::Element> objects or HTML strings after the last child of the L<element|HTML::Object::Element>.

It returns the objects thus inserted as an L<array object|Module::Generic::Array>.

Differences from L</appendChild>:

=over 4



( run in 0.629 second using v1.01-cache-2.11-cpan-364913b4093 )