Hello,
When I want to read CSS like this:
:::css
And want to read it like that:
:::java
By using the style.getPropertyValue(item)) method I only get attr() "testData" and not attr(test) "testData", so „test“ value is missing.
Am I doing something wrong or is it a Bug?
Can someone please help me?
Best regards
Simon
Thanks for "silently" fixing this Bug in Version 9.12 :)
You could have told me about that in this thread. Now it works...
Great Job :)
Sorry but i more or less forgot this forum entry. I'm focusing on the issue tracker. BTW. the next snapshot build is available
Log in to post a comment.
Hello,
When I want to read CSS like this:
:::css
heading:BEFORE {
content: attr(test) "testData";
}
And want to read it like that:
:::java
InputStream resourceAsStream = this.getClass().getResourceAsStream(
"./test.css");
org.w3c.css.sac.InputSource inputSource = new org.w3c.css.sac.InputSource(
new InputStreamReader(resourceAsStream));
System.setProperty("org.w3c.css.sac.parser",
SACParserCSS3.class.getName());
CSSOMParser parser = new CSSOMParser();
CSSStyleSheet styleSheet = parser.parseStyleSheet(inputSource, null,
null);
CSSRuleList cssRules = styleSheet.getCssRules();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < cssRules.getLength(); i++) {
CSSRule rule = cssRules.item(i);
if (rule instanceof CSSStyleRule) {
CSSStyleRule styleRule = (CSSStyleRule) rule;
String selectorText = styleRule.getSelectorText();
if (selectorText.toLowerCase().endsWith(":before")) {
CSSStyleDeclaration style = styleRule.getStyle();
for (int j = 0; j < style.getLength(); j++) {
String item = style.item(j);
if (item.startsWith("content")) {
String[] split = selectorText.split(":");
String originalSelector = split[0].trim();
// add additional content for special data
sb.append(originalSelector);
sb.append("[data-tag]");
sb.append(":BEFORE {");
sb.append("content: ");
sb.append("url(icons/tag.png) attr(data-tag) \"\a\" ");
// here is the problem that I only get back attr() "testData"
sb.append(style.getPropertyValue(item));
sb.append(";}\n");
}
}
}
}
}
System.out.println(sb.toString());
By using the style.getPropertyValue(item)) method I only get attr() "testData" and not attr(test) "testData", so „test“ value is missing.
Am I doing something wrong or is it a Bug?
Can someone please help me?
Best regards
Simon
Thanks for "silently" fixing this Bug in Version 9.12 :)
You could have told me about that in this thread.
Now it works...
Great Job :)
Sorry but i more or less forgot this forum entry. I'm focusing on the issue tracker.
BTW. the next snapshot build is available