it's me again =)
Not all attributes are converted to inline style. I noticed it with width and height attributes on img. But after i have red the code it became clear than it's not the only case when attributes aren't converted. For example only attributes from element nodes are converted, but what about fonts, colours and other? I wonder if there is a special reason it's like it is.
org.fit.cssbox.css.HTMLNorm.java : line 61 public static void attributesToStyles(Node n, String tab_inh)
Best regards,
Alexey
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
as for the width and height attributes: actually, it seems that in some pages, these attributes may be used together with the CSS definition (mainly for img elements). I haven't found any official specification that would cover these cases but from the behavior of other browsers, it seems that the algorithm is more comples than only converting the attributes to inline styles. Current implementation is in CSSDecoder.computeReplacedObjectSize() . Therefore, the width and height attributes are processed later during the box size computation.
The second part: I am not sure if I understand your question. Both the HTML attributes and CSS style definitions may be only used for element nodes. I.e. it makes no sense to process other node types.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Radek,
it's me again =)
Not all attributes are converted to inline style. I noticed it with width and height attributes on img. But after i have red the code it became clear than it's not the only case when attributes aren't converted. For example only attributes from element nodes are converted, but what about fonts, colours and other? I wonder if there is a special reason it's like it is.
org.fit.cssbox.css.HTMLNorm.java : line 61 public static void attributesToStyles(Node n, String tab_inh)
Best regards,
Alexey
Hi,
as for the width and height attributes: actually, it seems that in some pages, these attributes may be used together with the CSS definition (mainly for img elements). I haven't found any official specification that would cover these cases but from the behavior of other browsers, it seems that the algorithm is more comples than only converting the attributes to inline styles. Current implementation is in CSSDecoder.computeReplacedObjectSize() . Therefore, the width and height attributes are processed later during the box size computation.
The second part: I am not sure if I understand your question. Both the HTML attributes and CSS style definitions may be only used for element nodes. I.e. it makes no sense to process other node types.