Issue with loading js library – unpkg.com v cdnjs.cloudflare.com – inside DOMContentLoaded event

I was having an issue that I was not able to use .insertString("Hello") method of Trix editor. I was 100% following instructions of official documentation https://github.com/basecamp/trix#inserting-and-deleting-text

I found out that the issue is the location of Trix library I was using.

If Trix is loaded from https://cdnjs.cloudflare.com everything works fine but unpkg.com

Could someone please explain how come such issue is happening of the code is inside DOMContentLoaded event? I thought that load event would solve it but the javascript code inserting text is not working with load event at all. Working jsFiddle

// document.addEventListener("load", function(event) {
 document.addEventListener("DOMContentLoaded", function(event) {
    // Your code to run since DOM is loaded and ready
     
     var element2 = document.querySelector("trix-editor")
     element2.editor  // is a Trix.Editor instance
     element2.editor.insertString("Hello2")
     
    });`enter code here`