CSS-Inliner

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN


2544	2010-04-27	Kevin Kamel <kamelkev@mailermailer.com>
        * Update the regex for skipping over non-inlineable psuedo attributes
        * In addition to skipping psuedo attributes, skip over @, like @import

2669	2010-08-19	Kevin Kamel <kamelkev@mailermailer.com>
	* Include a number of contributions from Michael Peters <mpeters@plusthree.com>
          - do not die if there is no style container within passed document
          - do not die if comments are encountered within <style> blocks
          - contribution of tests to ensure described functionality matches up
          - respect order of CSS rules for better style cascade
        * Added option to selectively strip out class and id attributes via constructor param
        * Added automatic collapsing of overridden attributes, assisted by Vivek Khera <vivek@khera.org>
        * Restructured parts of code and added some get methods to ease future testing
        * Adjusted some variable names to be more correct

2852	2010-10-27	Kevin Kamel <kamelkev@mailermailer.com>
	* Manifest updated to represent all project files
	* Rework module hierarchy, adjust all project files to match
	* Include contributions from Michael Peters <mpeters@plusthree.com>
	  - Add support for specificity calculations
	  - Add support for style application that closely approximates what a browser does
	  - Included tests to validate above behaviour
	* Added extensive tests added to validate described cascade behaviour
	  - Fixed all discovered and known bugs
        * Include contribution from David Stevenson <david@ytfc.com>
	  - allow for proper parsing of background urls, previously broken
	  - include test for validating fix
	* Update CSS storage module to CSS::Simple
	* Add code to fetch remote stylesheets
	* Include contribution from Vivek Khera <vivek@khera.org>
	  - Add support for adusting all relative references to absolute reference
	* Add test to remotely fetch an entire document
	* Simplify some recursive methods

MANIFEST  view on Meta::CPAN

README
t/acidtest.t
t/advanced.t
t/advanced_strip.t
t/atrules.t
t/basic.t
t/basic_comment.t
t/basic_media.t
t/basic_pseudo.t
t/basic_redeclare.t
t/cascade.t
t/charset.t
t/css_url.t
t/custom_html_tree.t
t/embedded_style_block.t
t/entities_default.t
t/entities_utf8.t
t/fetch-filter.perl
t/fetch.perl
t/html/acidtest.html
t/html/acidtest_result.html

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

      #check to see if query fails, possible for jacked selectors
      eval {
        $query_result = $self->query({ selector => $selector });
      };

      if ($@) {
        $self->_report_warning({ info => $@->info() });
        next;
      }

      # CSS rules cascade based on the specificity and order
      my $specificity = $self->specificity({ selector => $selector });

      #if an element matched a style within the document store the rule, the specificity
      #and the actually CSS attributes so we can inline it later
      foreach my $element (@{$query_result->get_elements()}) {

       $matched_elements{$element->address()} ||= [];
        my %match_info = (
          rule     => $selector,
          element  => $element,

lib/CSS/Inliner/Parser.pm  view on Meta::CPAN

use warnings;

use Carp;

use Storable qw(dclone);

=pod

=head1 NAME

CSS::Inliner::Parser - Interface through which to read/write CSS files while respecting the cascade order

NOTE: This sub-module very seriously focuses on respecting cascade order. As such this module is not for you
      if you want to modified a stylesheet once it's read. If you are looking for that functionality you may
      want to look at the sister module, CSS::Simple

=head1 SYNOPSIS

 use CSS::Inliner::Parser;

 my $css = new CSS::Inliner::Parser();

 $css->read({ filename => 'input.css' });



( run in 0.470 second using v1.01-cache-2.11-cpan-49f99fa48dc )