but i may have misunderstood yes, it’s closing the commented part, but it seems that it doesn’t always work as you describe it: for closing also the comment element too, if you have white space between – and >, like this – > (or like in your example <– comments <!-- coments >), it’s not always doing that, although it should, if only by specs. only FF and Op seems to do so (and sometimes only FF). so we’re back to square one: it’s not working the same in all browsers.
it seems to me that using the <style> element to wrap parts of your code as commented, although it may seem strange and obviously a wrong use, may be the cleanest way. taking advange of the fact that the content of it does not render it’s beneficial. drawbacks: it’s used outside its scope (the head element), has no html logic, can be overlooked as it is the case of <==, ==> because it’s easier to implement. probably another html element whose content also does not render could be used, but as far as i lingered upon the idea, <script> didn’t appealed to me.