Menu

StyleMap - matching elements with more than one class

sourcerer
2012-10-21
2012-10-22
  • sourcerer

    sourcerer - 2012-10-21

    I'm having difficulties finding style properties for elements with more than one class.

    <b class="first second">

    returns me nothing efter creating a w3c element (e) and looking up with "NodeData nd = map.get(e);"

    i initialize stylemap with the following code: (css is a string, and properties for both classes can be found in it)

    StyleSheet sheet = CSSFactory.parse(css);
    Analyzer analyzer = new Analyzer(sheet);
    StyleMap map = analyzer.evaluateDOM(doc, "all", true);

    Thanks a lot, this is a great project!

     
  • Radek Burget

    Radek Burget - 2012-10-22

    And when you remove one of the classes, it starts working properly? Could you please post the corresponding HTML and CSS code for further tests?

     
    • sourcerer

      sourcerer - 2012-10-22

      i will simplify it and post here asap

       
  • sourcerer

    sourcerer - 2012-10-22

    after simplifying the incredibly long css and htmls i'have noticed it was because of my creation of w3e element. I've stripped style codes in the html itself and appended to the css string. Now it seems to work fine.

    but for simple test purposes a simple css and html is provided in the attached zip file. What i'm doing is calculating the computed font size of the texts. I'm doing that by creating a w3e element and traversing till root. Could not find a simple method for this, i guess inherit wont work that way.

    Thanks for your time!

     

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.