Ticket #616 (reopened defect)
getPosition() returns wrong values in Opera
| Reported by: | lebowski | Owned by: | |
|---|---|---|---|
| Type: | defect | Priority: | minor |
| Milestone: | Mootools version 1.2 | Component: | Core |
| Keywords: | Cc: |
Description
Opera seems to have some problems with getPosition() and inline elements.
Here's a simple example:
<div> <image src="" id="img1" style="width:20px;height:20px;" alt="1" /> <image src="" id="img2" style="width:20px;height:20px;" alt="2" /> <a href="#"><image src="" id="img3" style="width:20px;height:20px;" alt="3" /></a> <a href="#"><image src="" id="img4" style="width:20px;height:20px;" alt="4" /></a> </div>
window.addEvent('domready', function() {
alert(
'\n img1.x = ' + $('img1').getPosition().x +
'\n img2.x = ' + $('img2').getPosition().x +
'\n img3.x = ' + $('img3').getPosition().x +
'\n img4.x = ' + $('img4').getPosition().x
);
});
When setting all the margin/padding and borders to 0px (via css) and ignoring all the spaces and line breaks between the images, the expected values should be:
img1.x = 0
img2.x = 20
img3.x = 40
img4.x = 60
(Because these img-tags all should be in one line.)
Firefox and Safari return the correct values, but Opera did not. Opera returns:
img1.x = 0
img2.x = 20
img3.x = 0 -> wrong
img4.x = 0 -> wrong
Opera might have a problem with these anchor (inline) tags.
Browsers: Opera 9.24 (Mac), Safari 3.0 (Mac) and Firefox 2.0.0.9 (Mac)
Mootools: version 1.2b1