Toby Inkster

NAME

HTML::HTML5::DOM::HTMLDocument - implementation of the HTMLDocument interface of the HTML DOM

DESCRIPTION

HTML::HTML5::DOM::HTMLDocument is an implementation of the HTMLDocument interface of the HTML DOM. See HTML::HTML5::DOM for a list of the conventions that have been used when translating the DOM to Perl.

HTML Elements

This class applies to the following HTML elements.

Inheritance

HTML::HTML5::DOM::HTMLDocument inherits methods from the following Perl classes.

Additional Methods

As well as its inherited methods, this class provides the following methods.

  • AUTOLOAD

    See perlsub if you don't know the significance of the AUTOLOAD function. HTML::HTML5::DOM::HTMLDocument will pass through unknown menthods to the document's root element. So for example, $document->setAttribute will actually set an attribute on the document's root element.

  • URL

    Get/set the document's URL.

  • anchors

    Returns all <a> with a "name" attribute found in the document.

  • applets

    Returns all <applet> elements (and <object codetype="application/java"> elements) found in the document.

  • body

    Returns the document body.

  • characterSet

    Returns the character set that the document was parsed as (if known). As charset can be used as a setter, this is not necessarily the same as charset.

  • charset

    Getter/setter for the document encoding.

  • compatMode

    Returns the string 'quirks' or 'limited quirks' or undef.

  • cookie

    Ostensibly returns cookies associated with the document, but in this implementation always returns an empty string.

  • defaultCharset

    Returns the string 'utf-8'.

  • doctype

    This method is not implemented yet, but will eventually support the functionality defined in DOM Core 3.

  • documentURI

    Alias for URL.

  • domConfig

    Ostensibly an object representing settings which will be used when normalize is called. In practise, just returns an empty hashref that you can do with what you like.

  • domain

    The documents URL's host name.

  • embeds

    Returns all <embed> elements found in the document.

  • forms

    Returns all forms found in the document.

  • getElementById

    The world-famous getElementById method. The default XML::LibXML implementation of this does not work with HTML::HTML5::Parser documents, because HTML::HTML5::Parser lacks the ability to inform libxml which element to use as an ID. (libxml defaults to xml:id.) This implementation is XPath-based, thus slower.

  • head

    Returns the document head.

  • images

    Returns all images found in the document.

  • implementation

    Returns the same as HTML::HTML5::DOM->getDOMImplementation.

  • inputEncoding

    This method is not implemented yet, but will eventually support the functionality defined in DOM Core 3.

  • lastModified

    Ostensibly returns the current document readiness, but this implementation always returns the string 'complete'.

  • links

    Returns all <a> and <area> elements with an "href" attribute found in the document.

  • normalizeDocument

    Alias for normalize.

  • p5_tables

    Returns all tables found in the document.

  • plugins

    Returns all <embed> elements found in the document.

  • referer

    An alias for 'referrer' provided for the benefit of those who learnt to spell by reading HTTP RFCs.

  • referrer

    Ostensibly returns the HTTP referer for the document, but in this implementation always returns an empty string.

  • renameNode

    This method is not implemented yet, but will eventually support the functionality defined in DOM Core 3.

  • scripts

    Returns all scripts found in the document.

  • strictErrorChecking

    DOM seems a little vague as to what exactly constitutes 'strict'. This returns false.

  • title

    Returns the document's title, from its <title> element, with a little whitespace canonicalisation.

  • xmlEncoding

    This method is not implemented yet, but will eventually support the functionality defined in DOM Core 3.

  • xmlStandalone

    Called with an argument, acts as setStandalone; called without an argument, acts as standalone.

  • xmlVersion

    Returrns undef for documents parsed using an HTML parser; 1.0 or 1.1 if parsed using libxml.

BUGS

http://rt.cpan.org/Dist/Display.html?Queue=HTML-HTML5-DOM.

SEE ALSO

HTML::HTML5::DOM.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2012, 2014 by Toby Inkster.

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

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.