CSS hover properties not available in jQuery hover event under IE8
With the following html:
- <!DOCTYPE HTML>
- <html xml:lang="en-US" lang="en-US" dir="ltr">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>Test</title>
- <script TYPE="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
- <script type="text/javascript">
- $(function() {
- $("a").hover(
- function() {
- var spn = $(this).children("span");
- spn.html(spn.html() + "<br />My width is " + $(this).outerWidth());
- },
- function() { }
- );
- });
- </script>
- <style type="text/css">
- a span { display:none; }
- a:hover span { display:block; position: relative; width: 100px; }
- </style>
- </head>
- <body>
- <a href="#">a link <span>Some descriptions</span></a>
- </body>
- </html>
Under Firefox, the a:hover width property is correctly returned inside the jQuery hover event.
While under IE8, the a:hover width property is not available inside the jQuery hover event.
Why is this? This inconsistency is really annoying.