technosophos / querypath

QueryPath is a PHP library for manipulating XML and HTML. It is designed to work not only with local files, but also with web services and database resources.
http://querypath.org
Other
823 stars 114 forks source link

css method provides awkward get-functionality #62

Open arneke opened 12 years ago

arneke commented 12 years ago

Pasted from the support-list:

I am a bit surprised by the behavior of the css method. Reviewing the code, there does not seem to be any direct way to "get" a value without deleting it?

Not sure whether changing the default behavior would be considered breaking the API, but it also seems wrong that css('float') results in no value, instead of deleting the key completely: <... style="... float: ; ...">

How about changing the method so that $value = null just returns the value without changing the style-attribute?

technosophos commented 12 years ago

I'm going to tentatively earmark this for a 3.0.1 issue.

I'm not sure how much we can reasonably to, since there is no CSS computation engine to determine what CSS elements are in effect for a given element, but maybe we can at least parse a style attribute.

(In other words, for full CSS support, we'd need to parse all CSS and assign styles to each element. That'd be a little difficult.)