Documentation » API Reference

Application:

Class: CSS_Parser extends Parser

Parses CSS data into 3-dimensional associative arrays. Properly handles
multiple declaration blocks for the same element, but will only keep
the final value of a property that is declared again, which should not
be a problem for most cases. Also properly handles /* style comments.

Example:

Usage Example


<?php

loader_import 
('saf.HTML.CSS_Parser');

$css = new CSS_Parser ();

$css->parse ('a { text-decoration: none } div.content { line-height: 15px }');

info ($css->list['a']);

info ($css->getClasses ('div'));

?>

Return to Top



Properties


$comment false

Whether the parser is in a comment or not.


$block false

Whether the parser is in a block or not.


$list = array ()

  • Access: public

The structure created from the previous call to parse().

Return to Top



Methods


CSS_Parser () 

Constructor method.


getClasses ($tag false

  • Access: public
  • Return: array

Returns an array of classes found in the CSS data. Optionally
limits the classes to those that apply to the specified element.


getIDs ($tag false

  • Access: public
  • Return: array

Returns an array of IDs found in the CSS data. Optionally
limits the IDs to those that apply to the specified element.


getStyle ($tag

  • Access: public
  • Return: array

Returns all of the stylesheet properties of the specified element.


_comment ($token$name


_comment_end ($token$name


_default ($token$name


_block ($token$name


_block_end ($token$name

Return to Top