Opened 12 years ago

Last modified 10 years ago

#11614 closed defect

dojo.style(node, 'display', 'inherit') fails in IE6 and IE7 — at Initial Version

Reported by: jimben Owned by: anonymous
Priority: high Milestone: 2.0
Component: HTML Version: 1.5
Keywords: Cc: Eugene Lazutkin
Blocked By: Blocking:

Description

Behavior is normal in IE8, FF and Chrome.

Clearly the underlying bug is in IE6 and IE7, but handling the error more gracefully would prevent a broken page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dojo.style(node, 'display', 'inherit') fails in IE6 and IE7</title>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript">
    function callStyleInTryCatch(elementID, styleProp, value) {
        try {
            //this is the line where the reported bug behavior happens:
            dojo.style(elementID, styleProp, value);
            //next two lines are just decoration cleanup:
            dojo.byId('errorReport').innerHTML = "";
            dojo.removeClass(elementID, 'errorBlock');
        } catch (e) {
            //next lines are just decoration to make it easy to see the bug behavior:
            var innerHTML = "<div><code>dojo.style('" + elementID + "', '" + styleProp + "', '" + value + "')</code></div>"  +
                "<div>error description = <span>" +e.description + "</span></div>";
            var errNode = dojo.byId('errorReport');
            errNode.innerHTML = innerHTML;
            dojo.addClass(elementID, 'errorBlock');
        }
    }
</script>
<style type="text/css">
.block
{
    height: 100px;
    width: 100px;
    background-color: blue;
}
.errorBlock
{
    background-color: red;
}
#errorReport
{
    color: Red;
}
</style>
</head>
<body>
    <h2>dojo.style(node, 'display', 'inherit') fails in IE6 and IE7</code></h2>
    <button onclick="callStyleInTryCatch('displayTest','display','none')">display: none</button>
    <button onclick="callStyleInTryCatch('displayTest','display','')">display: ""</button>
    <button onclick="callStyleInTryCatch('displayTest','display','block')">display: block</button>
    <button onclick="callStyleInTryCatch('displayTest','display','inline')">display: inline</button>
    <button style="border: thin solid red" onclick="callStyleInTryCatch('displayTest','display','inherit')">display: inherit</button>
    <div>
        <div class="block" id="displayTest">DISPLAY</div>
    </div>
    <h2>Errors:</h2>
    <div id="errorReport" />
</body>
</html>

This problem seems to exist in previous versions of Dojo also.

Change History (0)

Note: See TracTickets for help on using tickets.