I am trying to manipulate the DOM extensively from my Gwt code. In the process I discovered two groups of classes implementing a common base interface e.g..
interface DivBuilder
class HtmlDivBuilder implements DivBuilder
class DOMDivBuilder implements DivBuilder
for each and every Html tag there are two such sets of classes implemented
I am confused as to what is the purpose and use behind this.
Any pointers shall be helpful .
The
Html
family builds a string that can later be used withinnerHtml
. It can be used server-side too.The
Dom
family builds a DOM subtree.The goal is you can have code that uses the builders and can be called with either concrete implementation depending on the use case. As an example, the cell table could use either strategy and the builders could stay the same.