When you work with TinyMCE you may face with an issue that gives the next error in console:

Uncaught TypeError: Cannot read property 'setAttribute' of undefined 
at b.aria (tinymce.min.js?ver=4603-20170530:10) 
at b.postRender (tinymce.min.js?ver=4603-20170530:10) 
at b.postRender (tinymce.min.js?ver=4603-20170530:11) 
at b.postRender (tinymce.min.js?ver=4603-20170530:10) 
at b.postRender (tinymce.min.js?ver=4603-20170530:15) 
at b.postRender (tinymce.min.js?ver=4603-20170530:10) 
at b. (tinymce.min.js?ver=4603-20170530:10) 
at Object.b as each at b.each (tinymce.min.js?ver=4603-20170530:10) 
at b.exec (tinymce.min.js?ver=4603-20170530:10) 

I had this on the TinyMCE version 4.6.3 (2017-05-30) that was included in WordPress 4.8. Same issues reported so(TinyMCE -> Cannot read property 'setAttribute' of null) gh1 gh2 (but maybe those are a little bit different). The latest versions may already have a fix but if you still cant migrate it by yourself (like in the case with WordPress), then you can try this tip.

The solution I noticed that issue can be reproduced if you have some code that appends something to body.innerHTML, e.g.:

document.body.innerHTML += 'something'; 

Also, I found that bug disappears if you use

var sp = document.createElement('span'); 
sp.innerHTML = 'something'; document.body.appendChild(sp); 

So try to find something that works with innerHTML in your code, that may cause the bug.