IE seems to automatically add the "selected" attribute in the option tag.
But then if you clone a Node, everything gets weird.
If you open the page in IE8 using the code below:
<html>
<body>
<form><select><option>o1</option></select></form>
<script>
var elm = document.getElementsByTagName('form')[0];
alert(elm.innerHTML);
elm = document.getElementsByTagName('form')[0].cloneNode(true);
alert(elm.innerHTML);
elm = document.getElementsByTagName('select')[0].cloneNode(true)
alert(elm.innerHTML);
</script>
</body>
</html>
You'll get:
The first warning, with a miserable "selected" attribute in the option tag.
The second warning, without an attribute in the option tag (this is normal, as in any other browser!)
The third notification with the repeated appearance of "selected"
Any idea why this attribute appears?
And why does cloneNode seem to accidentally delete it or not?
. , ?
, JS PURE
: -\