Access elements inside atom-text-editor shadow dom?


#1

I could have sworn that I could access the shadow dom using something like editor.getShadow() or editor.getShadowRoot(). Neither of those work with either TextEditor or TextEditorElement. Can someone tell me how to get an element inside the shadow dom?

I’ve searched here and atom/atom and all I get are selector questions which don’t help in this case.


#2

Try editor.shadowRoot.


#3

As @thomasjo wrote, you can use editor.shadowRoot to perform a querySelector call, or you can prefix your selector string with ::shadow, it also works: