import DOM from '@mojojs/dom';
let dom = new DOM('<div><p>Alex</p></div>');
dom.at('div').replace('<b>1</b>');
console.log(dom.toString()); // prints: <b>1</b>
dom = new DOM('<div><p>Alex</p></div>');
dom.at('div').replace(''hi');
console.log(dom.toString()); // prints: &#x27;hi
First replace invocation doesn't escape < or >, whereas second snippet escapes &. This behavior is inconsistent with Mojo::DOM, as can be shown by the following piece of code:
use Mojo::DOM;
my $dom = Mojo::DOM->new('<div><p>Alex</p></div>');
$dom->at('div')->replace('<b>1</b>');
say $dom->to_string; # prints <b>1</b>
$dom = Mojo::DOM->new('<div><p>Alex</p></div>');
$dom->at('div')->replace(''hi');
say $dom->to_string; # prints 'hi which is equivalent to 'hi