Explaining the Shadow DOM | Developer Quick Takes

  Рет қаралды 425,731

Salesforce Developers

Salesforce Developers

Күн бұрын

Пікірлер
@anderivative
@anderivative 2 жыл бұрын
She needs her own channel! That whole prez was absolutely perfect. Showed step by step from broad to specific and the differences with the vendor implementation.
@SalesforceDevs
@SalesforceDevs 2 жыл бұрын
She does! kzbin.info
@yatin1370
@yatin1370 6 ай бұрын
As a beginner, I was able to understand this completely and honestly I can't fathom how brilliantly this was taught. I'm so glad having invested considerable time for JS fundamentals.
@jasonli1060
@jasonli1060 4 жыл бұрын
Why does this sound so epic? "The events that you fire from the inner elements from the shadow tree are not going to escape the shadow boundary"
@hiddenwasabi
@hiddenwasabi Күн бұрын
Very clear and easy to understand. Thank you!
@RenoirB
@RenoirB Жыл бұрын
Amazing talk, I've been using all of this for a while now and that's my favourite explanation!
@lmkcolassi.9389
@lmkcolassi.9389 3 жыл бұрын
Thank you Alba, really appreciate your generosity that was simple concise and easy to understand. Hope your are well. peace and bounty to you
@RajendraSinghRSN
@RajendraSinghRSN 4 жыл бұрын
Quick takes are good as they are easily consumable as compared to long sessions where 10-15 mins are wasted on arrangement & not so useful slides. Nice & well organized content 👍
@SalesforceDevs
@SalesforceDevs 4 жыл бұрын
Thank you for the feedback!
@softwareengineeringandsale4005
@softwareengineeringandsale4005 3 жыл бұрын
Nice video, not sure why this has so many down votes. People are weird.
@aritramukherjee
@aritramukherjee 4 жыл бұрын
This is nice comparison. Short and crisp. Thanks.
@theidk9567
@theidk9567 11 ай бұрын
You know what is funny? I just tried so hard to access your s via injected script (in salesforce app) to modify it, because the text doesnt have features our team needs. I tried for hours and thought to myself "what the hell, why is it not in DOM when I see it?". And then I found out this video, from Salesforce explaining how it works :D. Well, atleast Im a little smarter, but its a shame that I cannot do anything with that editor. Thank you for the explanation, indeed its an extremely nice feature, only for me right now a little limiting. (If you are curious, the problem I had was with the Salesforce text editor, where highlighting text and pressing ctrl+v doesnt make the text a hyperlink but instead rewrites it)
@AlbaRivasSalesforce
@AlbaRivasSalesforce 11 ай бұрын
Hello, glad you find it useful! You have a longer explanation here: kzbin.info/www/bejne/imiyeHeDh9OdipY. Know that you can enable individual components to use Light DOM instead, however that won't open base components. developer.salesforce.com/blogs/2023/10/demystifying-light-dom-and-its-use-cases
@DmitriGoncharov
@DmitriGoncharov 4 жыл бұрын
Please make more videos like that! Thank you for a short yet great video!
@aishmeenkaur9376
@aishmeenkaur9376 4 жыл бұрын
, B.
@vaishalidewangan1672
@vaishalidewangan1672 2 жыл бұрын
very nice explanation.
@SalesforceDevs
@SalesforceDevs 2 жыл бұрын
Thanks for liking
@TechleadConsulting
@TechleadConsulting 2 жыл бұрын
Hola Elba, Great Explanation
@SalesforceDevs
@SalesforceDevs 2 жыл бұрын
Thank you! 😃
@tophersymps
@tophersymps 4 жыл бұрын
Very well explained, thank you!
@ramparkashkhara7875
@ramparkashkhara7875 4 жыл бұрын
Very nice efforts we are happy.
@liamhunt8542
@liamhunt8542 3 жыл бұрын
Why does this have so many dislikes? Just curious if there's something inaccurate in the video. Seems pretty helpful to me
@SalesforceUSA
@SalesforceUSA 3 жыл бұрын
good video
@siripurapukavya2120
@siripurapukavya2120 4 жыл бұрын
Short and Crisp content for a quick grasp. Thanks a lottt...!!!
@jflowers45
@jflowers45 4 жыл бұрын
I really enjoyed how you started off with vanilla JavaScript and then brought it into the context of LWC. Very polished. Well done!
@philippreich7302
@philippreich7302 7 ай бұрын
can i use multiple Off-Plattform LWC on the same page?
@julianancizarhurtadotorres3619
@julianancizarhurtadotorres3619 4 жыл бұрын
Edge chromium supports native DOM. This version was deployed in all windows 10 in the last update.
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
My bad - still older browsers don't support it and we need the polyfill - developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.get_started_supported_browsers
@gurbantasingh6872
@gurbantasingh6872 4 жыл бұрын
.
@theartist8835
@theartist8835 4 жыл бұрын
you can use document.body to query the body element.
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
What I showcase in the video is how to query elements that belong to a shadow DOM tree (you have to query them using the shadowRoot property) vs elements that belong to the light DOM. "body" belongs to the light DOM, so you can query it normally. The shadow DOM tree in this example is attached to the div element I create (which is a child of body).
@viggie007
@viggie007 2 жыл бұрын
Very helpful to simple to understand! Thanks. We're having an issue with a 3rd party JS that's trying to translate the page content dynamically - we use Lightning Out to render a Lightning component within a VisualForce page - the shadow-root fragment surrounding the Lightning component is random in this case. Whenever the the component is encapsulated within the shadow-root fragment the 3rd party JS results in a rendering issue. Is there a way to consistently always produce or exclude the shadow-root fragment?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 2 жыл бұрын
I think in your case Light DOM should help developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_light_dom
@yveromeev
@yveromeev 4 жыл бұрын
Only one silly tiny moment: Salesforce LWC DOESN'T USE SHADOW DOM like it's supposed to be. Instead, they add unique attributes in order to split CSS
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
That's because we do need to support older browsers (for now), developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.get_started_supported_browsers but if you use LWC outside of the platform, you can use the native one
@yveromeev
@yveromeev 4 жыл бұрын
​@@AlbaRivasSalesforce Does it mean that LWC is going to use the native shadow dom in Salesforce in future? If yes, does Salesforce understands that it will break tons of legacy code that hacks the current shadow dom implementation via static resources and manual dom css injections? There are lots of cases where it's required to extend/shorten the standard components like input-field or datatable which are very difficult to re-implement for a little style change. For instance: there is a need to make the textarea higher than it is by default... or hide the clip/wrap arrows in the datatable Another question is: in that case how are the standard components going to follow SLDS stylesheet which is supposed to be acceptable for the light dom only?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
​@@yveromeev yes, we know, and we are working on a plan for this. We are evaluating how we want to approach it. Regarding styling of base components, we've recently published www.lightningdesignsystem.com/platforms/lightning/styling-hooks/ (beta), that may help.
@selvaraj8112
@selvaraj8112 4 жыл бұрын
Ity to úo9976746867
@Khriztopher6220
@Khriztopher6220 2 жыл бұрын
what is the use case scenario of Shadow DOM?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 2 жыл бұрын
It's implemented in LWC, the web components framework that we use at Salesforce, to prevent other vendor components to access yours. See a more detailed explanation here --> kzbin.info/www/bejne/imiyeHeDh9OdipY
@gabrielmayta2297
@gabrielmayta2297 4 жыл бұрын
Nice short video, LWC seems a very good library to work with WebComponets. Just one question is it possible to disable the shadowDOM?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
No, it's not possible, as it's one of the standards in which web components are based and we enforce it, as it provides the encapsulation capabilities that will make your code robust, trustful and reusable.
@aBhIsHeKsInGh-tl4gs
@aBhIsHeKsInGh-tl4gs 4 жыл бұрын
@@AlbaRivasSalesforce यरयय
@aakashsathe9309
@aakashsathe9309 4 жыл бұрын
@@AlbaRivasSalesforce 1+.🤪🤪🤪🤪🤪🤪🤪🤣
@doncasanada3413
@doncasanada3413 4 жыл бұрын
7
@amnairfan7926
@amnairfan7926 4 жыл бұрын
M
@lmkcolassi.9389
@lmkcolassi.9389 3 жыл бұрын
Should you have referred LIGHT DOM as ROOT DOM instead ?
@AlbaRivasSalesforce
@AlbaRivasSalesforce Жыл бұрын
AFAIK it's known as Light DOM javascript.works-hub.com/learn/web-components-api-shadow-dom-and-light-dom-e18b6
@rahuljawale4461
@rahuljawale4461 2 жыл бұрын
will the css from the outer(main) DOM effect the styling of shadow dom??
@AlbaRivasSalesforce
@AlbaRivasSalesforce 2 жыл бұрын
Cascaded values are not, only inherited ones. This is what the shadow boundary prevents. See a more advanced session here: kzbin.info/www/bejne/imiyeHeDh9OdipY
@marcc1179
@marcc1179 Жыл бұрын
thanks!
@naveenkothuri380
@naveenkothuri380 4 жыл бұрын
Mam can u plz explain the working underhood where events are used
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
I'll create another video about shadow DOM and events soon. Meanwhile, you can take a look at developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.events_propagation, where it's very well explained how to configure events to bubble & escape the shadow DOM if needed.
@krushnachandranayak8833
@krushnachandranayak8833 4 жыл бұрын
\l22w2
@kultttemo
@kultttemo 3 жыл бұрын
Why did you delete the comments? I see a lot of dislikes and I want to know why people complain. It is obvious there is wrong information in this video. I am not gonna watch it now.
@AlbaRivasSalesforce
@AlbaRivasSalesforce 3 жыл бұрын
not sure what you mean, I think we haven't deleted any comments :) if you have any concrete questions about shadow DOM of the video feel free to ask them, I'll be happy to answer
@kultttemo
@kultttemo 3 жыл бұрын
@@AlbaRivasSalesforce Nevermind, I had a bad day. Thanks for your videos.
@baddu88
@baddu88 4 жыл бұрын
So any mark up inside div tags in lightning web component is by default encapsulated or can be considered as a shadow tree?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
Yes, any markup inside a component template (its html file) will belong to the component shadow DOM and will be encapsulated - which all the benefits that this implies
@عادلالشعلانالغامدي
@عادلالشعلانالغامدي 4 жыл бұрын
شاهي بالانجليزي تي قال الله تعالى ((فَهَلْ يَنظُرُونَ إِلَّا السَّاعَةَ أَن تَأْتِيَهُم بَغْتَةً ۖ فَقَدْ جَاءَ أَشْرَاطُهَا ۚ فَأَنَّىٰ لَهُمْ إِذَا جَاءَتْهُمْ ذِكْرَاهُمْ (18)
@rizwanashekhrizwana3507
@rizwanashekhrizwana3507 4 жыл бұрын
Mai aapka fan hu I am altashar sheikh I love this your video's please aap doody man ki aur video's Nikal sakte hai please
@Overthought7
@Overthought7 2 жыл бұрын
This video is sorely lacking an explanation of the purpose and/or use cases of a shadow DOM!
@SalesforceUSA
@SalesforceUSA 4 жыл бұрын
I have 11 Salesforce Certifications. Is it enough?
@AlbaRivasSalesforce
@AlbaRivasSalesforce 3 жыл бұрын
It's not a matter of the number of certifications that you have, but your abilities to apply your knowledge and soft skills! certifications are going to help you learn though :)
@meenamehta365
@meenamehta365 4 жыл бұрын
Very good.god bless you.
@ironajijiul
@ironajijiul 4 жыл бұрын
I love you ma'am thanks for this question
@baddu88
@baddu88 4 жыл бұрын
Any real world use case for this in lwc context
@AlbaRivasSalesforce
@AlbaRivasSalesforce 4 жыл бұрын
You're using shadow DOM implicitly in every LWC you create. Example: when you build LWCs, you sometimes will have to query the DOM - for example, you may want to look for a button and click on it calling its click() method. To do that, you'll have to query the component shadow DOM, (element.template.querySelector(...)), and not the component DOM (element.querySelector()), which is what you normally do in non-web components HTML. This provides the encapsulation benefits mentioned above. For instance, let's say that you download a component from the app exchange, and you include the component into another component you have built. You write some CSS styles for your component's background-color. Without having shadow DOM, those styles could leak into the 3rd party component, because of CSS cascading - which is something we probably want to avoid. But with shadow DOM, the 3rd party component will remain unchanged and protected from external modifications. Also, you have the control to decide which events escape the shadow boundary of the components that you create - having a higher degree of control of what you expose to the outside world. I'll do another video about how events behave with shadow DOM soon :)
@baddu88
@baddu88 4 жыл бұрын
@@AlbaRivasSalesforce thank you very much for detailed explanation
@ovidodabay3746
@ovidodabay3746 4 жыл бұрын
Oùuù
Декларативный Shadow DOM для изоляции стилей
20:19
Вадим Макеев
Рет қаралды 14 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
The DOM in 4 minutes
3:51
Aaron Jack
Рет қаралды 126 М.
Web Components Crash Course
28:54
Traversy Media
Рет қаралды 258 М.
But what is a neural network? | Deep learning chapter 1
18:40
3Blue1Brown
Рет қаралды 18 МЛН
HTML Templates Instead Of Reactivity | Prime Reacts
12:42
ThePrimeTime
Рет қаралды 118 М.
Learn flexbox the easy way
34:04
Kevin Powell
Рет қаралды 742 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 918 М.
OAuth 2.0 and OpenID Connect (in plain English)
1:02:17
OktaDev
Рет қаралды 1,8 МЛН
Deep Dive: Shadow DOM & CSS in Lightning Web Components
1:15:56
Salesforce Developers
Рет қаралды 12 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,3 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН