CSS-DOM

 view release on metacpan or  search on metacpan

lib/CSS/DOM.pm  view on Meta::CPAN


Parses the rule contained in the C<$css_code>, inserting it in the style
sheet's list of rules at the given C<$index>.

=item deleteRule ( $index )

Deletes the rule at the given C<$index>.

=item hasFeature ( $feature, $version )

You can call this either as an object or class method.

This is actually supposed to be a method of the 'DOMImplementation' object.
(See, for instance, L<HTML::DOM::Interface>'s method of the same name,
which delegates to this one.) This returns a boolean indicating whether a
particular DOM module is implemented. Right now it returns true only for
the 'CSS2' and 'StyleSheets' features (version '2.0').

=back

=head2 Non-DOM Methods

=over 4

=item set_ownerNode

This allows you to set the value of C<ownerNode>. Passing an argument to
C<ownerNode> does nothing, because it is supposed to be read-only. But you
have to be able to set it somehow, so that's why this method is here.

The style sheet will hold a weak reference to the object passed to this
method.

=item set_href

Like C<set_ownerNode>, but for C<href>.

=item property_parser

=item url_fetcher

These two both return what was passed to the constructor. The second one,
C<url_fetcher> also allows an assignment, but this is not propagated to
sub-rules and is intended mainly for internal use.

=back

=head1 FUNCTIONS

=over

=item CSS::DOM::parse

See L</CONSTRUCTORS>, above.

=item CSS::DOM::compute_style( %options )

B<Warning:> This is still highly experimental and crawling with bugs.

This computes the style for a given HTML element. It does not yet calculate
actual measurements (e.g., converting percentages to pixels), but simply
applies the cascading rules and selectors. Pseudo-classes are
not yet supported (but pseudo-elements are).

The precedence rules for normal vs important declarations in the CSS 2 
specification are used. (CSS 2.1 is unclear.) The precedence is as follows,
from lowest to highest:

 user agent normal declarations
 user normal declarations
 author normal     "
 user agent !important declarations
 author !important "
 user      "       "

The C<%options> are as follows. They are all optional except for 
C<element>.

=over

=item ua_sheet

The user agent style sheet

=item user_sheet

The user style sheet

=item author_sheets

Array ref of style sheets that the HTML document defines or links to.

=item element

The element, as an L<HTML::DOM::Element> object.

=item pseudo

The pseudo-element (e.g., 'first-line'). This can be specified with no 
colons (the way Opera
requires it) or
with one or two colons (the way Firefox requires it).

=item medium

=item height

=item width

=item ppi

(To be implemented)

=back

The 

=back

=head1 CLASSES AND DOM INTERFACES



( run in 0.769 second using v1.01-cache-2.11-cpan-39bf76dae61 )