Move code that modifies the DOM into the compile function.

 * The element passed to the link function is now the DOM we expect the final element to have.
 * Use 'pre' instead of 'link' as then it will be processed before all child directives. This is needed so the that the final table is fully initallized before processing child element.