Skip to main content

Bug Tracker

Side navigation

Ticket #5700: ie8bug.html


File ie8bug.html, 1.2 KB (added by matiasnu, December 22, 2009 11:54AM UTC)

Testcase

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>jQuery 1.3.2 Selector bug in IE8</title>
	</head>
	<body>
        <div class="elem">Element 1</div>
        <div class="elem">Element 2</div>
        <div class="elem">Element 3</div>
        <hr/>
        <p>This will work in Firefox 3.5 and Chrome, but not in IE8, which will select all elements</p>	   
	    <button class="b1">Using .elem:not(:first)</button>
	    <p>This will work in all browsers, since we're using TAG.class</p>	   
	    <button class="b2">Using div.elem:not(:first)</button>
	    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
	    <script type="text/javascript">
	        $().ready(function() {
                $("button.b1").click(function() {
                    $(".elem:not(:first)").css("background", "red");      
                });
                
                $("button.b2").click(function() {
                    $("div.elem:not(:first)").css("background", "green");      
                })   
            });
	    </script>
	</body>
</html>

Download in other formats:

Original Format