/** * Get style from parent node. from first paret 'firstF', we will traverse the tree up untile * reaching Document node, get all style node's, we may insert rules here to stop the search at a * before paricular node. Style nodes could <b>, <u>... * * @param children * @param firstF */ void assignFather(Vector children, Node firstF) { if (children.size() == 0) { return; } if (firstF != null && !isDocument(firstF)) { String name = firstF.getNodeName(); // To see whether it is a style node that is our anticipated node. if (name != null && HTML_STYLE_NODES.contains(name.toLowerCase())) { Node newParent = firstF.cloneNode(false); while (children.size() > 0) { newParent.appendChild((Node) children.remove(0)); } children.add(newParent); } assignFather(children, firstF.getParentNode()); } }