JavaScript: document.documentElement.innerHTML not showing all the elements

113
May 01, 2019, at 03:00 AM

I'm trying to figure out how to get all the elements of html. For example if I load this google page google search I'll see this result:

I see the source code for that particular section of the page I see this:

<a href="https://www.macworld.com/article/3331839/iphone-2019-rumors-everything-you-need-to-know.html" onmousedown="return rwt(this,'','','','38','AOvVaw07dY5FgPEzcYsd8enm-9gs','','2ahUKEwicoNi4yPjhAhVdCTQIHVxICj4QFjAlegQIABAB','','',event)">
<h3 class="LC20lb">iPhone 2019 rumors: Everything you need to know | Macworld</h3><br><div class="TbwUpd">
<cite class="iUh30">https://www.macworld.com/.../iphone-2019-rumors-everything-you-need-to-know.ht...</cite></div></a>

But if use document.documentElement.innerHTML the output would be this:

<div class="g"><h3 class="r">
<a href="/url?q=https://www.macworld.com/article/3331839/iphone-2019-rumors-everything-you-need-to-know.html&amp;sa=U&amp;ved=0ahUKEwiU__rUy_jhAhWIHzQIHTrGBzIQFghLMAo&amp;usg=AOvVaw2C3PdwxIaeNuukMVSwC-5g">
<b>iPhone 2019</b> rumors: Everything you need to know | Macworld</a>
</h3><div class="s"><div class="hJND5c" style="margin-bottom:2px">

My question to you guys why the difference between seen the source code and running document.documentElement.innerHTML?

Also using javascript how can see or query an element like this:

<a href="https://www.macworld.com/article/3331839/iphone-2019-rumors-everything-you-need-to-know.html" onmousedown="return rwt(this,'','','','38','AOvVaw07dY5FgPEzcYsd8enm-9gs','','2ahUKEwicoNi4yPjhAhVdCTQIHVxICj4QFjAlegQIABAB','','',event)">
<h3 class="LC20lb">iPhone 2019 rumors: Everything you need to know | Macworld</h3><br><div class="TbwUpd">
<cite class="iUh30">https://www.macworld.com/.../iphone-2019-rumors-everything-you-need-to-know.ht...</cite></div></a>

I'll really appreciate your help.

Rent Charter Buses Company
READ ALSO
How can I reuse function chains in Javascript?

How can I reuse function chains in Javascript?

I'm using a functional library (Gremlin) to query a graph databaseInvoking it looks like this:

139
Console.logging an object shows that the object contains a property that had not yet been assigned

Console.logging an object shows that the object contains a property that had not yet been assigned

Not necessarily a problem, but I am not sure why my code works the way that it does and I'm hoping to find some answers here

163
Deleting all records in indexedDB object store for a specific index value

Deleting all records in indexedDB object store for a specific index value

For an object store with an array key of [a,b] where a is also an index, is there a more efficient way to delete all records for a specific value of a than opening a cursor on the index a and deleting each record as step through the cursor?

139
How to change a variable audio file value when calling a function to play the audiofile in Vanilla JavaScript?

How to change a variable audio file value when calling a function to play the audiofile in Vanilla JavaScript?

I am working on a project that when I used a specific keyboard's key a different sound must be playedI have a created a function to play the sound, then I attached an Event Listener to the DOM & finally I checked which key has been pressed & play the sound who correspond...

118