Need an intervention here, as I am pretty much losing my mind on this 0_o
I am using IE 9 and am using IE's F12 developer tools, trying to test for IE8. I am performing a pretty simple task with JavaScript.
I am grabbing some inner html - using it as a sting for whatever reason.
Like this:
<div id="Some_Container_div">
<div class="Some_Inner_Div_Class">sometext</div>
<div class="Some_Inner_Div_Class">sometext</div>
<div class="Some_Inner_Div_Class">sometext</div>
</div>
<script>
var Div_Contaiers_Inner_Html_As_String = document.getElementById('Some_Container_div').innerHTML;
alert(Div_Contaiers_Inner_Html_As_String);
Array_Of_Divs = Div_Contaiers_Inner_Html_As_String.split("</div>");
alert(Array_Of_Divs);
</script>
The above code properly alerts: First:
<div class="Some_Inner_Div_Class">sometext</div><div class="Some_Inner_Div_Class">sometext</div><div class="Some_Inner_Div_Class">sometext</div>
Then the second alerts the proper array:
<div class="Some_Inner_Div_Class">sometext,<div class="Some_Inner_Div_Class">sometext,<div class="Some_Inner_Div_Class">sometext,
If I now use the developer tools (f12) and switch to "Browser Mode" IE8 and I switch the "Document Mode" also to IE8 the browser now alerts :
First:
<DIV class=Some_Inner_Div_Class>sometext</DIV><DIV class=Some_Inner_Div_Class>sometext</DIV><DIV class=Some_Inner_Div_Class>sometext</DIV>
- Notice the missing quotes now?
- Notice the capitalization of the words 'DIV' now?
And next it alerts the same thing:
<DIV class=Some_Inner_Div_Class>sometext</DIV><DIV class=Some_Inner_Div_Class>sometext</DIV><DIV class=Some_Inner_Div_Class>sometext</DIV>
So it looks like it is not even splitting the string into an array now - not sure why, like it was not a string anymore.
If I now use the developer tools (f12) and keep "Browser Mode" IE8 and I switch the "Document Mode" also to IE9 - it works fine again....
So thanks so much for confusing me again Bill Gates 0_O
Anyway - so I looked through here for help - I see some people saying you should switch both "Browser Mode" to IE8 and "Document Mode" also to IE8 when testing with developer tools - but I do not see an explanation I understand as to why. and what is the difference if you switch just one or both.
In the mean time:
- Can anyone tell me if this is going to work properly in IE8?
- Why it is stripping the quotes out?
- Why is it not creating the array in developer tools testing mode?
Thanks to all : )