Shadow DOM, purpose of use

I recently studied the Shadow DOM, and I was wondering what are the goals of using it instead of the main one.

What does he give? Why don't we use the standard DOM instead (except for the scope)?

+4
source share
1 answer

It allows you to encapsulate functionality, effectively putting it in a black box. This means that you can create [reusable] components whose internal work is not displayed; this is not possible using the standard DOM.

HTML. , , file. HTML, <input type="file" />, . HTML CSS , , , . , HTML/CSS/JS, , . file - , , . - , , Shadow DOM . , <my-fantastic-file-input />, . DOM, ; . .

DOM, /. , , , / , , . , DOM.

2011 , : http://www.w3.org/2008/webapps/wiki/Component_Model_Use_Cases

+8

Source: https://habr.com/ru/post/1613969/


All Articles