This project is archived and is in readonly mode.

#1233 ✓wontfix
x-yuri

getPosition doesn't always work before opera 10.50

Reported by x-yuri | May 19th, 2011 @ 11:32 PM

before opera 10.50 tr has scrollTop equal to border-spacing. And it makes getPosition return wrong result. Reproduce code:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <style type="text/css">
        td {
            padding: 0;
        }
        table {
            background: #eee;
            border-spacing: 2px;
        }
        body {
            margin: 10px;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td>
                <div id="test" style="
                    width: 100px;
                    height: 100px;
                    background: #966;
                ">test</div>
    </table>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
    <script type="text/javascript">
        d([
            $('test').getPosition().x,
            $('test').getPosition().y,
            $('test').getParent('tr').scrollTop,
            $('test').getBoundingClientRect
        ]);
        d(window.opera.version());

        function d(s){
            document.body.appendChild(document.createTextNode(s));
            document.body.appendChild(document.createElement('br'));
        }
    </script>
</body>
</html>

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages