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!
Tip to use Array methods on dom elements from document.querySelectorAll() 1) Array.from(document.querySelectorAll(“element”)) 2) […document.querySelectorAll(“.selector”)]
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.
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.
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! :)
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' }
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
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.
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 :)
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.
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.
What Kyle teaches: CSS styling
What I want to learn: Hair styling
😂
😁😁
He did it recently x)
@@DracoVoldre I saw 🙌
The thing I like about Kyle's CSS tutorials is he always does it with style.
This guy is born to be a teacher and mentor
You are genious bro. Instead of focusing on just basic things you always dive deeper.
You are awesome brother. You clear all my doubt. Love from 🇮🇳
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!
I found this on your website and came to RUclips to give you a like. Super helpful!!!! This cleared up a lot
Tip to use Array methods on dom elements from document.querySelectorAll()
1) Array.from(document.querySelectorAll(“element”))
2) […document.querySelectorAll(“.selector”)]
Thank you. Useful tips.
Thanks for this!
You just save my life.
I am working on a project and I need to understand this.
Thank you.
Also Nodelist can easily be converted into array with spread operator to be able to have all JavaScript array method functionality
Great tip brother.
I agree
Can we use Array.from()
This was my pain, could not understand the weird behavior of the nodes and elements. Thank you very much, now I understand.
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.
Thank you so much, I was breaking my head trying to understand the differences between the nodes and the elements and how they work 🙃
Extremely helpful video ❤️
Thank you Kyle for giving this cheat sheet.Your teaching is also awesome 👌👌
That info on live updates is really useful 🙂
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.
Awesome! Well explained and simplified
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! :)
Thank you for videos. Love from Turkey 🙂
Wow! AMAZING video Kyle!
Bro, I absolutely Love this video!
Can't thank you enough for this! You really saved me from a couple of headaches lol
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' }
I'm not sure how to set this up?
Super well explained. thank you!
Kyle don't use any vscode theme but still he customizes it a lot which we cannot see directly !
Learned something new today, thank you!
Thanks for this video and clear explanation.
thanks alot, kyle your tips and teachings are very informative and helpful.
I lost you at Element. Thanks for sharing
Awesome information, thanks for sharing
Thank you very much Kyle for your detailed explanations.
Thank you Kyle, Thank you very much!
i had no idea about the live update thing. ty
Thanks, that video helped a lot!
This helped me soo much
Great explainer, thank you Kyle.
Thanks for all man
I always had doubts when it comes HTML node and element
Couldn't you easily convert either type of collection to arrays and not have to deal with live updates if that is not desired?
Great Video...learnt alot!
Awesome Kyle thanks!
Great content! thank bro
That's a good point. thanks!
Shedding light on the dark corners 🙌
So a node is a superset of an element? Every element is a node but not every node is an element?
I think elements is a subset of a node.
great video thanks a lot for your tip
Please cover advance concepts of ES6 and ES7
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
Great content
Learned something new!
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.
Can we get a collection of your cheat sheets Kyle? Pleeease!
I thought it's Node JS vs Someother New technology like Nodejs. 😂
Hahaha samee😂
me too
i immediately searched for element js XD
Me toooooo
I thought the same
but Kyle, why would we wanna have a static list that doesn't live-update ??
I think it's useful in filtering;
Please do a tutorial on next js..
oOo that's why you prefer querySelector instead of getElementsByClassName !
super awesome
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?
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 :)
@@mhombach3035 Sounds very reasonable! Great! Thanks for sharing! :)
I ask this my self a long time. Now i gonna figure it
Does this prevent live updates?
const parents = Object.freeze(document.getElementsByClassName('parent'))
I've got four consecutive notifications this video, its like youtube trying to get an answer for you.
do you but do you?
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.
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.
Beast
Hlo sir I need ur help... how can I contact u?
wonderfull
4th
I'm more inclined to listen to someone who plays a Jackson.
First comment , I know that's dumb but...😂
Your the 1st
That’s amazing 💪🏼
@@Arabian_Abomination thanks 😃