IE Bork Test for document.createElement('style')

If the background is yellow your browser is working

This page calls a js file with the following code

function init() { 
    
	var styles = document.createElement('style');
	styles.setAttribute('type', 'text/css');


	var newStyle = document.createTextNode('\n<!--\nbody {\nbackground-color: yellow;}\n-->\n'); 
	styles.appendChild(newStyle);
  
	var headRef = document.getElementsByTagName('head')[0];
	headRef.appendChild(styles); 
}
  
window.onload = init();

What I think is happening

Internet Explorer is returning the error "unexpected call to method or property access". I guess IE is getting confused between the head element <style> and the object property .style ?