Element.visible() returns true, even though the element has display:none defined in css.
<html>
<head>
<script type="text/javascript" src="prototype.js"></script>
<style type="text/css">
#x { display:none; }
</style>
</head>
<body>
<div id='x'>
hello
</div>
<script type="text/javascript">
alert($('x').visible());
</script>
</body>
</html>
Alert box displays 'true' - should be 'false'.
Following patch fixes the problem, by using getStyle() in visible()
Index: prototype/src/dom.js
===================================================================
--- prototype/src/dom.js (revision 4254)
+++ prototype/src/dom.js (working copy)
@@ -50,7 +50,7 @@
Element.Methods = {
visible: function(element) {
- return $(element).style.display != 'none';
+ return $(element).getStyle('display') != 'none';
},
toggle: function() {