danfickle / neoflyingsaucer

[Deprecated - Please use openhtmltopdf at link] An attempt to modernize flyingsaucer, the HTML and CSS 2.1 renderer in pure Java

Home Page:https://github.com/danfickle/openhtmltopdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inline styles don't get applied.

hrj opened this issue · comments

commented

Given something like this:

<html>
   <body>
     <div>
       <style> body > div {border:4px solid #555} </style>                          
     </div>
  <body>
</html>

... the style doesn't get applied. Moreover, the text of the style tag gets shown in the output.

Is this expected behavior? I am not sure if inline styles in body are standard compliant, though most browsers seem to support them fine.

commented

Oh, in that case, I can close this issue.

Just one thing; the first answer in SO says HTML5 allows inline style with a scoped attribute. Do you plan to support that? This issue could be then restricted to HTML5 support for <style>.

Leave the issue open, we may decide to support it at a later date.

Note to self: This should be easy to support in the Jsoup to W3C DOM module, by inserting any extra style elements into the head at this stage.

Test case at: com.github.neoflyingsaucer.test.BackgroundTest.testBackgroundImageWithStyleOutsideHead()