Похожие чаты

When you are using childNodes, why does the comment sometimes

become 3 and sometimes 8?

val = list.childNodes;

Comment is 8 but when you look at the console, it now turns up as 3?

8 ответов

5 просмотров

what do you mean comment

Charlemagne-Holdt Автор вопроса
david
what do you mean comment

When you do val = list.childNodes; console.log(val); And after you add a comment in HTML page and do this val = list.childNodes; console.log(val); The NodeList turns out to add another 2. And when you check out the node type of 3, val = list.childNodes; val = list.childNodes[0]; val = list.childNodes[0].nodeName; val = list.childNodes[3].nodeType; console.log(val); It now turns up 8.

Charlemagne-Holdt Автор вопроса
david
what do you mean comment

So I’m wondering why just adding a comment in HTML page, the NodeList adds another 2 by just checking out childNodes[3].nodeType;

Charlemagne Holdt
When you do val = list.childNodes; console.log(v...

It probably adds 2 nodes because one is the comment node and the other is the whitespace after it

Charlemagne-Holdt Автор вопроса
Thomas
It probably adds 2 nodes because one is the commen...

In a HTML page, </li> <! — Comment —> <li class=“collection-item”> Is just adding the comment in between </li> and <li> considered adding whitespace too?

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Почему у макбука экран не сенсорный?
✨ Anatolii Cherednichenko
28
Всем привет! подскажите пожалуйста как можно увеличить качество фото?
Evgeniy
19
а как ловят такое ghci> res <- getPos2 urlt 0 (alist !! 0) 200 ghci> res SearchAtom (Search "www.google.com" "/search?q=" "Haskell") "haskell.org" (SearchTS [(2024-05-06 07:...
Fedor
14
Is it a good price to buy hex now on 0,0019?
Patrick
29
ну выйграл ты ее а дальше что?
central hardware
17
Карта сайта