Do You Know The Difference?

  Рет қаралды 55,857

Web Dev Simplified

Web Dev Simplified

Күн бұрын

FREE DOM Traversal Cheat Sheet: webdevsimplified.com/js-dom-t...
If you have ever worked with the DOM before then chances are you have worked with both nodes and elements. No matter what you do with the DOM you have to interact with one or the other, but which is the right choice for you? In this video I will explain the differences between nodes and elements so you can make the right choice.
📚 Materials/References:
FREE DOM Traversal Cheat Sheet: webdevsimplified.com/js-dom-t...
Node vs Element Article: blog.webdevsimplified.com/202...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:26 - Node vs Element
4:30 - HTMLCollection vs NodeList
#NodeVsElement #WDS #JavaScript

Пікірлер: 92
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
What Kyle teaches: CSS styling What I want to learn: Hair styling
@arunrawat3142
@arunrawat3142 2 жыл бұрын
😂
@gopalloharnew5948
@gopalloharnew5948 2 жыл бұрын
😁😁
@DracoVoldre
@DracoVoldre Жыл бұрын
He did it recently x)
@SuboptimalEng
@SuboptimalEng Жыл бұрын
@@DracoVoldre I saw 🙌
@sidthetech7623
@sidthetech7623 2 жыл бұрын
The thing I like about Kyle's CSS tutorials is he always does it with style.
@fabaladibbasey7453
@fabaladibbasey7453 2 жыл бұрын
Also Nodelist can easily be converted into array with spread operator to be able to have all JavaScript array method functionality
@buraksurumcuoglu8303
@buraksurumcuoglu8303 2 жыл бұрын
Great tip brother.
@faizanahmed9304
@faizanahmed9304 Жыл бұрын
I agree
@ruturajbhandari7695
@ruturajbhandari7695 Жыл бұрын
Can we use Array.from()
@DilanDog
@DilanDog 2 жыл бұрын
This guy is born to be a teacher and mentor
@programmingforfun4158
@programmingforfun4158 Жыл бұрын
You are genious bro. Instead of focusing on just basic things you always dive deeper.
@Stevie1derson
@Stevie1derson 2 жыл бұрын
Tip to use Array methods on dom elements from document.querySelectorAll() 1) Array.from(document.querySelectorAll(“element”)) 2) […document.querySelectorAll(“.selector”)]
@samandarboymurodov8941
@samandarboymurodov8941 2 жыл бұрын
Thank you. Useful tips.
@ayushkushwaha171
@ayushkushwaha171 Жыл бұрын
Thanks for this!
@oldclient
@oldclient 2 жыл бұрын
Very informative. First time I noticed the difference between these DOM methods when I worked with , and nodes in a project. You have to notice that Node also is handling attributes and other DOM types. Therefore, the nodeType of a Node has these values: 1 (element), 2 (attribute), 3 (text) and more... Nine or ten in total currently.
@connorallen162
@connorallen162 2 жыл бұрын
Super helpful! this was such a mystery to me. Though I see why direct DOM manipulation isn't exactly encouraged for beginners, this kind of operation could really use a framework to make it more maintainable and scalable!
@AustinThomasFilms
@AustinThomasFilms 9 ай бұрын
I found this on your website and came to KZbin to give you a like. Super helpful!!!! This cleared up a lot
@m4m205
@m4m205 2 жыл бұрын
You just save my life. I am working on a project and I need to understand this. Thank you.
@karthicksj1936
@karthicksj1936 2 жыл бұрын
Thank you Kyle for giving this cheat sheet.Your teaching is also awesome 👌👌
@nsharma4981
@nsharma4981 2 жыл бұрын
Only you can demystify the most cryptic of JavaScript's intricacies in such an easily understandable manner within 9 minutes, Kyle! This was really helpful! :)
@DarkSomaX
@DarkSomaX Жыл бұрын
Thank you so much, I was breaking my head trying to understand the differences between the nodes and the elements and how they work 🙃
@codlover1468
@codlover1468 2 жыл бұрын
You are awesome brother. You clear all my doubt. Love from 🇮🇳
@pierre3639
@pierre3639 4 ай бұрын
Awesome! Well explained and simplified
@talatkuyuk6556
@talatkuyuk6556 2 жыл бұрын
This was my pain, could not understand the weird behavior of the nodes and elements. Thank you very much, now I understand.
@HarshKapadia
@HarshKapadia 2 жыл бұрын
Wow! AMAZING video Kyle!
@franciswayungi3519
@franciswayungi3519 2 жыл бұрын
Thank you very much Kyle for your detailed explanations.
@talhaibnemahmud
@talhaibnemahmud 2 жыл бұрын
Extremely helpful video ❤️
@justanotherhotguy
@justanotherhotguy 2 жыл бұрын
Learned something new today, thank you!
@alexmercer8984
@alexmercer8984 2 жыл бұрын
Bro, I absolutely Love this video!
@bones_twisting_sorrow4750
@bones_twisting_sorrow4750 2 жыл бұрын
Great explainer, thank you Kyle.
@Nashiuz
@Nashiuz 9 ай бұрын
Thanks, short and to the point. I like Kyle's videos only for this reason.
@YaseenAli08
@YaseenAli08 Жыл бұрын
thanks alot, kyle your tips and teachings are very informative and helpful.
@johnnypark5398
@johnnypark5398 Жыл бұрын
Super well explained. thank you!
@bayasahamed1815
@bayasahamed1815 10 ай бұрын
Thanks for this video and clear explanation.
@raven.4815
@raven.4815 Жыл бұрын
Can't thank you enough for this! You really saved me from a couple of headaches lol
@sereneabrahammathew9738
@sereneabrahammathew9738 2 жыл бұрын
That info on live updates is really useful 🙂
@dave6012
@dave6012 2 жыл бұрын
Yup, can’t say how many times I’ve redefined the same query selector inside functions for dynamic content. Now I know I can keep just one definition in the global scope to get the updates.
@Enes-ik4bm
@Enes-ik4bm 2 жыл бұрын
Thank you for videos. Love from Turkey 🙂
@deepaknegi4385
@deepaknegi4385 2 жыл бұрын
Awesome information, thanks for sharing
@Stormpaw
@Stormpaw Жыл бұрын
Thanks, that video helped a lot!
@michaeleke3913
@michaeleke3913 2 жыл бұрын
Great Video...learnt alot!
@naveedalirehmani4135
@naveedalirehmani4135 2 жыл бұрын
Thank you Kyle, Thank you very much!
@milanpavlovic8141
@milanpavlovic8141 10 ай бұрын
This helped me soo much
@tomasgilamoedo8301
@tomasgilamoedo8301 Жыл бұрын
Great content! thank bro
@yaseenlakhdhar6090
@yaseenlakhdhar6090 2 жыл бұрын
Awesome Kyle thanks!
@vahidseyidov
@vahidseyidov 9 ай бұрын
Thanks for all man
@raymondyoo5461
@raymondyoo5461 2 жыл бұрын
great video thanks a lot for your tip
@geforcesong
@geforcesong 2 жыл бұрын
That's a good point. thanks!
@MrTomro
@MrTomro 2 жыл бұрын
i had no idea about the live update thing. ty
@PerfectionOfError
@PerfectionOfError 2 жыл бұрын
Learned something new!
@shwackthenoobsac
@shwackthenoobsac 2 жыл бұрын
Great content
@realfranciscohermida
@realfranciscohermida 2 жыл бұрын
Couldn't you easily convert either type of collection to arrays and not have to deal with live updates if that is not desired?
@tomraaff4576
@tomraaff4576 2 жыл бұрын
you can use instanceof to see if a node is an HTML element. It makes working with nodes easier. ie. if (node instanceof HTMLElement) { node.innerText = 'this is an html element' }
@simonshurety3870
@simonshurety3870 Жыл бұрын
I'm not sure how to set this up?
@arulmuruganK94
@arulmuruganK94 2 жыл бұрын
I always had doubts when it comes HTML node and element
@viktorberczeli3009
@viktorberczeli3009 2 жыл бұрын
Can we get a collection of your cheat sheets Kyle? Pleeease!
@gopalloharnew5948
@gopalloharnew5948 2 жыл бұрын
Kyle don't use any vscode theme but still he customizes it a lot which we cannot see directly !
@dave6012
@dave6012 2 жыл бұрын
Shedding light on the dark corners 🙌
@srinik9999
@srinik9999 2 жыл бұрын
I thought it's Node JS vs Someother New technology like Nodejs. 😂
@nayyyhaa
@nayyyhaa 2 жыл бұрын
Hahaha samee😂
@mzpl7357
@mzpl7357 2 жыл бұрын
me too
@jonathanjeshualaniba5958
@jonathanjeshualaniba5958 2 жыл бұрын
i immediately searched for element js XD
@AshokKumar-yi5ph
@AshokKumar-yi5ph 2 жыл бұрын
Me toooooo
@WillAyeAce
@WillAyeAce 2 жыл бұрын
I thought the same
@suryapratapsingh5149
@suryapratapsingh5149 2 жыл бұрын
Please cover advance concepts of ES6 and ES7
@user-mf1ft6iz4l
@user-mf1ft6iz4l 2 жыл бұрын
super awesome
@user-mo3cw6go7c
@user-mo3cw6go7c 2 жыл бұрын
I ask this my self a long time. Now i gonna figure it
@hartztech8098
@hartztech8098 2 жыл бұрын
Great to reason for selecting because HTMLCollection its update automatically, When we selected sometime we don't want to update selecting further that we required.
@zenlogie9310
@zenlogie9310 2 жыл бұрын
but Kyle, why would we wanna have a static list that doesn't live-update ??
@benbrahimilias426
@benbrahimilias426 Жыл бұрын
I think it's useful in filtering;
@vatsalyasinghi438
@vatsalyasinghi438 2 жыл бұрын
Please do a tutorial on next js..
@Pacvalham
@Pacvalham 2 жыл бұрын
Does this prevent live updates? const parents = Object.freeze(document.getElementsByClassName('parent'))
@AsakuraAvan
@AsakuraAvan Жыл бұрын
So a node is a superset of an element? Every element is a node but not every node is an element?
@benbrahimilias426
@benbrahimilias426 Жыл бұрын
I think elements is a subset of a node.
@SanjeevKumar-fi1kt
@SanjeevKumar-fi1kt 2 жыл бұрын
Hlo sir I need ur help... how can I contact u?
@tinmank
@tinmank 2 жыл бұрын
I've got four consecutive notifications this video, its like youtube trying to get an answer for you. do you but do you?
@batuhanunal9380
@batuhanunal9380 10 ай бұрын
wonderfull
@alexmahone501
@alexmahone501 2 жыл бұрын
Beast
@alexandersage1850
@alexandersage1850 2 жыл бұрын
Before I watch… my guess is that nodes refer to anything while element refers to just tag based ones. Element would exclude text nodes and such Edit: despite my poor wording, I appear to be correct. Sweeeeeeet
@Shuyinz
@Shuyinz 2 жыл бұрын
I didn't get it. Why would you prefer static over live update on HTML? I can't see any real case scenario where it would be harder to debug?
@mhombach3035
@mhombach3035 2 жыл бұрын
That was my question too, but I guess that in bigger projects you never know what sideeffects are triggered by calling some function. And let's say you are iteration through the "live updated list" with a for-loop and you are creating a const before that loop and store the list's length in there, then the iteration is faulty if some new element is added inbetween, because the for-loop won't reach the end of the array since it changed length. I guess it's not "bad practice" to use either, you just have to be knowing what you want to do, what things are happening inside your app and then decide for the best method :)
@Shuyinz
@Shuyinz 2 жыл бұрын
@@mhombach3035 Sounds very reasonable! Great! Thanks for sharing! :)
@gopalloharnew5948
@gopalloharnew5948 2 жыл бұрын
oOo that's why you prefer querySelector instead of getElementsByClassName !
@funnyclipsmsda
@funnyclipsmsda 2 жыл бұрын
I have a request for a video. I do HTML, CSS and JS coding. For one of my projects, I require a custom scrollbar. I know how to make one, but the conventional ::-webkit scrollbars aren't as customizable as I'd like. What I'm looking for is to replace the scrollbar with a div, so that you have to drag the div to scroll, not the scrollbar thumb. Please help me, I haven't found a solution online yet.
@smilo_don
@smilo_don 2 жыл бұрын
One way would be to make the div draggable then use the ondrag event to calculate a position and scroll to it using window.scrollTo but it can be dragged both horizontally and vertically so you would have to lock it to only one.
@Arabian_Epileptic
@Arabian_Epileptic 2 жыл бұрын
4th
@trentreimer130
@trentreimer130 2 жыл бұрын
I'm more inclined to listen to someone who plays a Jackson.
@mohammedelhadididi4612
@mohammedelhadididi4612 2 жыл бұрын
First comment , I know that's dumb but...😂
@Arabian_Epileptic
@Arabian_Epileptic 2 жыл бұрын
Your the 1st That’s amazing 💪🏼
@mohammedelhadididi4612
@mohammedelhadididi4612 2 жыл бұрын
@@Arabian_Epileptic thanks 😃
JavaScript Arrays Crash Course
6:04
Web Dev Simplified
Рет қаралды 95 М.
Another 5 Must Know JavaScript Features That Almost Nobody Knows
22:42
Web Dev Simplified
Рет қаралды 212 М.
WHY DOES SHE HAVE A REWARD? #youtubecreatorawards
00:41
Levsob
Рет қаралды 41 МЛН
Black Magic 🪄 by Petkit Pura Max #cat #cats
00:38
Sonyakisa8 TT
Рет қаралды 37 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 10 МЛН
Não tenha medo❤️
0:54
Talita Santos
Рет қаралды 3,2 М.
HTMLCollection vs. NodeList Explained!
19:44
The Code Creative
Рет қаралды 11 М.
Learn DOM Manipulation In 18 Minutes
18:37
Web Dev Simplified
Рет қаралды 1 МЛН
How To Create Advanced CSS Dropdown Menus
16:09
Web Dev Simplified
Рет қаралды 467 М.
NodeLists versus HTMLCollections in the DOM
14:58
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 14 М.
The Most Important Skill You Never Learned
34:56
Web Dev Simplified
Рет қаралды 73 М.
Learn JavaScript DOM Traversal In 15 Minutes
14:44
Web Dev Simplified
Рет қаралды 219 М.
Learn CSS Grid the easy way
37:04
Kevin Powell
Рет қаралды 869 М.
Mongoose Crash Course - Beginner Through Advanced
33:36
Web Dev Simplified
Рет қаралды 442 М.
Learn Dynamic Module Imports In 11 Minutes
11:37
Web Dev Simplified
Рет қаралды 139 М.
WHY DOES SHE HAVE A REWARD? #youtubecreatorawards
00:41
Levsob
Рет қаралды 41 МЛН