Adding ignoreFlag and preserving dom structure during replace