views:

63

answers:

1

Good day!

I'm not sure if I hit the bug, so please confirm that I'm not mad. I use IE 8.0.7600.16385 on 3 different machines.

Here is simple page (I tested with both JQuery 1.4.2 and 1.3.2). It just displays alert if hidden link is visible. It displays 'false' in all browsers I have and in my IE8 when security zone is set to 'Trusted intranet' or it in IE7 compatibility mode. But when I upload this page (or change security zone to 'Internet') -- it displays 'true'.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" lang="ru">
<head>
    <title>     
    </title>       
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />       
        <script type="text/javascript" src="js/jquery.js"></script> 
</head>

<body>
<script type="text/javascript">
    $(function(){
        $('#vct-save-settings').click(function(){
            alert('Is visible hidden element: ' + $('#vct-show-similar').is(':visible'));           
        });
    });
</script>

<div class="vct-controls">
    <a href="#" id="vct-hide-similar">Shown element</a>
    <a href="#" id="vct-show-similar" style="display: none;">Hidden element</a>
    <a href="#" id="vct-save-settings">click me!</a>
</div>

</body>
</html>

So, the question is: why JQuery behaves different regardless of IE8 security zones?

Thanks in advance!

+1  A: 
Pointy
Thanks for the quick answer, it seems the security zones also affect on other JQuery functionality -- for example sorting from JQuery UI etc. It seems some restrictions are applied to Javascript. May be you have any details on it?It seems very-very frustrating to have browser behave fundamentally different with default settings...
artvolk
Link to the bug-report page: http://dev.jquery.com/ticket/6199It seems you haven't mentioned that it behaves differently on different security zones...
artvolk
No the bug report doesn't mention that - I'll add a comment. Actually this is the first time I've ever heard of such weird behavior from IE8. I've seen other strange things, but nothing like this, with differences in different security zones.
Pointy
Can I ask you to check you your demo by adding your link (http://gutfullofbeer.net/visible.html) to local intranet zone temporary in your IE8. If I'm not mad it should work. Thanks!
artvolk
OOps - I had commented that I could not make IE report "false", but I had just done it wrong - so yes, I agree with you - it behaves exactly as you say!
Pointy
Also it seems to happen for tags other than `<a>`; I changed the test to use a `<span>` tag and it behaves exactly the same way.
Pointy
Can you update a bugreport? Thanks!
artvolk
IE8 reports 'false' when a) I delete the first link (before hidden)or b) Turn on IE7 compatibility:<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
artvolk
OK, well I think that bottom line for the jQuery code is that it needs to trust the reported height/width less than the current CSS style. I'm sure they don't go for the style right away because it's probably more expensive than checking height/width.
Pointy
patrick dw
I'm afraid that IE security zones have more bugs... (I have hit at least two, but I didn't have test cases yet)
artvolk