Node cloneProps ( Node n ) { if ( ! n . hasProps ( ) ) { n . clonePropsFrom ( templateNode ) ; } for ( Node child : n . children ( ) ) { cloneProps ( child ) ; } return n ; }
Clone the properties from the template node recursively skips nodes that have properties already .