It is possible select YouTube live chat components?

  dom, javascript

Why YouTube live chat components cannot be selected using document.querySelector?
Is it purposeful or just a consequence of a framework used on the site? And how does the browser render it if it’s not in the document?

For instance, if I open a YouTube live and click to get the CSS Selector of the chat text field I get this selector:

yt-live-chat-text-input-field-renderer.style-scope > div:nth-child(2)

And if try execute this in browser console:

document.querySelector('yt-live-chat-text-input-field-renderer.style-scope > div:nth-child(2)');

It returns null.

Is there a way to select this element? If not, how can I hide elements of my site to avoid scripts select them?

Source: Ask Javascript Questions

LEAVE A COMMENT