jhy/jsoup — Issue #142: Feature request: Add css method for getting/setting information in the style attribute
Author: dariusj18
Created: 2011-11-24 09:01:24+00:00
State: open

It would be a nice if the style attribute was parsed into an object and a method "css" added to the Elements class.

Such that given

String html = "

Lorem ipsum.

";
Document doc = Jsoup.parseBodyFragment(html);
Element elem = doc.select("div").first();

You could then do this

String fontSize = elem.css("font-size");

or

elem.css("font-size", ""); or elem.css("font-size", "1.5em");

I imagine this would be quite complicated with css shorthand, but even the most basic functionality would be a pretty cool start.