HTML::Object::DOM::Element::Style - HTML Object DOM Style Class
use HTML::Object::DOM::Element::Style; my $style = HTML::Object::DOM::Element::Style->new || die( HTML::Object::DOM::Element::Style->error, "\n" );
v0.1.0
This interface represents a style element. It inherits properties and methods from its parent, HTML::Object::DOM::Element.
style
+-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+ | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Style | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+
Inherits properties from its parent HTML::Object::DOM::Element
Is a boolean value reflecting the HTML attribute representing whether or not the stylesheet is disabled (true) or not (false).
See also Mozilla documentation
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:
media
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-.
<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>
Is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true).
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.
undef
href
Under JavaScript, this returns the CSSStyleSheet object associated with the given element, or undef if there is none
CSSStyleSheet
Is a string representing the type of style being applied by this statement.
if( $newStyle->type != "text/css" ) { # not supported! warnCSS(); }
Inherits methods from its parent HTML::Object::DOM::Element
Jacques Deguest <jack@deguest.jp>
Mozilla documentation, Mozilla documentation on style element
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.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.