Test case details

Preparation Code

<div id="bob">hi[br]bob</div> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script> var bob_div = $("#bob"),     bob_div_text = $("#bob").text(); $.fn.text2 = function(text) {     this.text(text);     this.html(this.html().split('[br]').join('<br>'));     return this; }; $.fn.text3 = function(text) {     this.text(text);     this.html(this.html().replace('[br]','<br>'));     return this; }; </script>

Test cases

Test #1

bob_div.text2(bob_div_text);

Test #2

bob_div.text3(bob_div_text);