Menu

html + embedded svg. stylesToDomInherited() destroys content of style attribute of svg elements.

Alex
2014-11-22
2014-11-24
  • Alex

    Alex - 2014-11-22

    Hello Radek,

    I'm using jStyleParser and CSSBox to parse html and css and convert styles to inline with respect to @media. I would like to thank you for your work, it's great!

    Now about the problem. I have a html with embeded svg and want to embed styles to html. I use stylesToDomInherited() function of DOMAnalyzer object. It works great, but processes svg tree like it's part of html. As result content of style attributes is lost and replaced with inherited properties from html like line-height.
    SVG tree should be processed differently (not being processed at all is a great variant). CSSBox native support for HTML+svg would be the best. I wonder if you can implement this feature? It's absolutely needed for me so I'm going to implement it anyway and any comments are appreciated.

    Best regards,
    Alexey

     
  • Alex

    Alex - 2014-11-22

    simple example of html with embeded svg.

     
  • Alex

    Alex - 2014-11-23

    Well, seems like I have worked too much. A short walk has helped me. Avoiding the use of stylesToDomInherited() and using getElementStyleInherited() or original content of style attribute from document for html-tree and svg-tree respectively solved my problem. Thank you again =)

     
  • Radek Burget

    Radek Burget - 2014-11-24

    Hi, I am glad that you solved the problem. Anyway, it makes sense that stylesToDomInherited() stops on the svg element, i.e. it does not process its children. I will probably add some basic support for the svg tag. Thanks for your comment.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.