NAME

HTML::Object::DOM::Element::Style - HTML Object DOM Style Class

SYNOPSIS

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

VERSION

    v0.1.0

DESCRIPTION

This interface represents a style element. It inherits properties and methods from its parent, HTML::Object::DOM::Element.

INHERITANCE

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

PROPERTIES

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

disabled

Is a boolean value reflecting the HTML attribute representing whether or not the stylesheet is disabled (true) or not (false).

See also Mozilla documentation

media

Is a string representing the intended destination medium for style information.

Example:

    <!doctype html>
    <html>
        <head>
            <link id="LinkedStyle" rel="stylesheet" href="document.css" type="text/css" media="screen" />
            <style id="InlineStyle" rel="stylesheet" type="text/css" media="screen, print">
            p { color: blue; }
            </style>
        </head>
        <body>
        </body>
    </html>

    say( 'LinkedStyle: ' . $doc->getElementById( 'LinkedStyle' )->media ); # 'screen'
    say( 'InlineStyle: ' . $doc->getElementById( 'InlineStyle' )->media ); # 'screen, print'

Operators that can be used in the media value:

  • and

    Specifies an AND operator

  • , (comma)

    Specifies an OR operator

  • not

    Specifies a NOT operator

Device names (not enforced by this interface) that can be used in the media value:

  • all

    Suitable for all devices. This is the default.

  • aural

    Speech synthesizers

  • braille

    Braille feedback devices -- for the visually impaired

  • handheld

    Handheld devices with small screens and limited bandwidth

  • projection

    Projector devices

  • print

    Printed pages or in print-preview mode

  • screen

    Computer screens

  • tty

    Teletypes and similar devices using a fixed-pitch character grid

  • tv

    Television type devices with low resolution and limited scrolling

Tokens that can be used in the media value:

  • aspect-ratio (width/height)

    Ratio of width/height of the targeted display. Name can be prefixed with min- or max-.

  • color (integer)

    Bits per color of targeted display. Name can be prefixed with min- or max-.

  • color-index (integer)

    Number of colors the targeted display supports. Name can be prefixed with min- or max-.

  • device-aspect-ratio (width/height)

    Ratio of width/height of the device or paper. Name can be prefixed with min- or max-.

  • device-height (pixels)

    Height of the device or paper. Name can be prefixed with min- or max-.

  • device-width (pixels)

    Width of the device or paper. Name can be prefixed with min- or max-.

  • grid (1 = grid, 0 = otherwise)

    Whether output device is a grid or bitmap type.

  • height (pixels)

    Height of targeted display. Name can be prefixed with min- or max-.

  • monochrome (integer)

    Bits per pixel in a monochrome frame buffer. Name can be prefixed with min- or max-.

  • orientation (landscape, portrait)

    Orientation of the device or paper.

  • resolution (dpi or dpcm)

    Pixel density of the targeted display or paper. Name can be prefixed with min- or max-.

  • scan (progressive interlace)

    Scanning method of a tv display.

  • width (pixels)

    Width of targeted display. Name can be prefixed with min- or max-.

Example:

    <style media="all and (orientation: portrait)"></style>
    <style media="screen and (aspect-ratio: 16/10)"></style>
    <style media="screen , (device-height: 540px)"></style>
    <style media="screen , (aspect-ratio: 5/4)"></style>
    <style media="screen and not (min-color-index: 512)"></style>
    <style media="screen and (min-width: 1200px)"></style>
    <style media="screen and (max-height: 720px)"></style>
    <style media="handheld and (grid: 1)"></style>
    <style media="tv and (scan: interlace)"></style>
    <style media="print and (resolution: 400dpi)"></style>
    <style media="screen and (max-monochrome: 2)"></style>
    <style media="screen and not (device-width: 360px)"></style>
    <style media="screen , (color: 8)"></style>

See also Mozilla documentation

scoped

Is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true).

See also Mozilla documentation

sheet

Under perl, this always returns undef, because processing a stylesheet would be time consuming, and an object is returned only when there is a href HTML attribute set.

Under JavaScript, this returns the CSSStyleSheet object associated with the given element, or undef if there is none

See also Mozilla documentation

type

Is a string representing the type of style being applied by this statement.

Example:

    if( $newStyle->type != "text/css" )
    {
         # not supported!
         warnCSS();
    }

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 style element

COPYRIGHT & LICENSE

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.