phpquery icon indicating copy to clipboard operation
phpquery copied to clipboard

Phpquery css

Open kevee opened this issue 12 years ago • 1 comments

This branch introduces CSS parsing, including the CSSParse library (https://github.com/sabberworm/PHP-CSS-Parser) which has a compatible license to be included within PHPQuery (MIT).

Aside from using the CSSparsing library, this brach allows users to call pq($el)->css('background') to retrieve css styling of elements, or css('background', 'black') to set CSS styles on elements. All changes or parsing to elements bubble down the DOM tree and compare specificity correctly.

The only thing users have to do is add CSS strings that aren't already in the document captured by "

The branch also includes a default CSS file as provided by the W3C [http://www.w3.org/TR/CSS21/sample.html] for HTML4 so we can infer standard colors and backgrounds for all elements.

kevee avatar Mar 30 '12 21:03 kevee

There's still a few things missing:

  1. We're expanding things like background and margin, which is a good thing, but these cause requests for 'background' to not work as expected, instead users must ask for the sub-components of these type of selectors. This is partially because of the way CSSParser works.
  2. Percentage-based sizes aren't affected by bubbling, but could be added easily.

kevee avatar Mar 30 '12 22:03 kevee