Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

attachShadow "mode" open vs closed?

I have watched a few videos on Shadow DOM as some light viewing. Everyone appears to just ignore this mode. "Just don't make it closed" "Basically it is less flexible and you don't want it closed".

attachShadow( { mode: 'open' } )

Anyone concisely explain what this does?

Is a HTMLVideoElement an example of a closed Shadow? I believe you can't create a shadow here because one already exists but you cannot access it or has this no relation?

Thanks.

like image 663
Clark Avatar asked Mar 09 '23 00:03

Clark


1 Answers

For the difference between closed and open mode, look at this answer:

What is the difference between open and closed shadow DOM encapsulation mode?

A <video> element uses a user-agent shadow DOM. It's a third form of Shadow DOM but it acts as a closed Shadow DOM. About user-agent one, see this question:

How to get element in shadow root with JavaScript?

like image 136
Supersharp Avatar answered Mar 11 '23 15:03

Supersharp