Opera 7.x combined CSS / JS bug

The following code:

CSS:

#div1 { background-color: red; }
#container #div2 { background-color: red; }
HTML:

<div id="container">
	<div id="div1">div 1</div>
	<input type="button" onclick="document.getElementById('div1').style.backgroundColor='blue';" value="makeblue div1">
	<div id="div2">div 2</div>
	<input type="button" onclick="document.getElementById('div2').style.backgroundColor='blue';" value="makeblue div2">
</div>

When trying to change the set CSS properties through javascript this works fine for div1, but will not work for div2 which has 2 id-selectors in the rule.
Definitely a precedence bug.
Tested with Opera 7.53, 7.54 and is still present in the latest 7.6 preview versions although I reported this bug to Opera already 6 months ago.

Example:

div 1
div 2