Hey guys i was going through the modal.js plugin , and i have a problem with the following line of code :
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
The above line can be found on git too.
Where is offsetWidth and clientWidth coming from , they don't seem to be declared anywhere in the plugin and also i checked the MDN documentation and they don't seem to be names of any methods or functions , So what exactly is offsetWidth and clientWidth ??
Also Why is that is that while appending to the body element and removeing the element from the body tag are the syntax different ?
this.$body[0].removeChild(scrollDiv);
What the [0] ?? can't the syntex , just be :
this.$body.removeChild(scrollDiv);
if i console.log this.$body , i get
{ 0: <body.modal-open>, context: <body.modal-open>, length: 1 }
but if i console.log this.$body[0] , i get :
<body class="modal-open">.
I would really appreciate if somebody can give me a short explanation .
Thank you.
Alexander.