added methods replaceWith() and replaceAll(), rewritten adding of HTML fragments