jStyleParser is a CSS parser written in Java. It has its own application interface that is designed to allow an efficient CSS processing in Java and mapping the values to the Java data types. It parses CSS 2.1 style sheets into structures that can be efficiently assigned to DOM elements. It is intended be the primary CSS parser for the CSSBox library. While handling errors, it is user agent conforming according to the CSS specification.
NodeData'spush() method when called from DirectAnalyzer'sgetElementStyle() method was mutating the original Term values from the StyleSheet which was passed to the DirectAnalyzer while constructing it.
To avoid this, Term now implements Cloneable interface, so wherever we want to mutate the term, we can get a clone of it and then mutate it. This will keep the original values intact.
This problem was being initially encountered for the following test case :-
where the operator of the line-height was being set to null, the second time when we were calling the getElementStyle() the operator SLASH(/) was missing, which was required for it to match a variant in processFont() method in DeclarationTransformer's. processFont() was called from parseDeclaration() method in the same class. Since the operator was missing, the font property would have been invalid.
NodeData's
push()
method when called fromDirectAnalyzer's
getElementStyle()
method was mutating the originalTerm
values from theStyleSheet
which was passed to theDirectAnalyzer
while constructing it. To avoid this, Term now implementsCloneable
interface, so wherever we want to mutate the term, we can get a clone of it and then mutate it. This will keep the original values intact.This problem was being initially encountered for the following test case :-
where the operator of the
line-height
was being set tonull
, the second time when we were calling thegetElementStyle()
the operatorSLASH(/)
was missing, which was required for it to match a variant inprocessFont()
method inDeclarationTransformer
's.processFont()
was called fromparseDeclaration()
method in the same class. Since theoperator
was missing, thefont
property would have been invalid.