This project is archived and is in readonly mode.

#23 ✓resolved
Thomas Aylott

getPosition() returns wrong values in Opera

Reported by Thomas Aylott | May 28th, 2008 @ 10:00 AM | in 2.0 (closed)

Originally posted on Trac by lebowski

Original Trac Ticket

Description

Opera seems to have some problems with getPosition() and inline elements.

Here's a simple example:

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

Trac Attachments

Trac Comments

Changed 4 months ago by w00fz


        
Should be fixed in = 9.50  ..." class="changeset">[1355]. Please, reopen if it's not. 

                  Changed 4 months ago by w00fz

          priority
              changed from trivial to minor
        
          resolution
              set to fixed
        
          status
              changed from new to closed
        
          component
              changed from Plugins to Core

Should be fixed in = 9.50  ..." class="changeset">[1355]. Please, reopen if it's not. 

          priority
              changed from trivial to minor
        
          resolution
              set to fixed
        
          status
              changed from new to closed
        
          component
              changed from Plugins to Core
        
      

Changed 4 weeks ago by hthetiot


        
bug allways here : 

to fix : 

	getPosition: function(relative){
		if (isBody(this)) return {x: 0, y: 0};
		var offset = this.getOffsets(), scroll = this.getScrolls();
		var position = {x: offset.x - scroll.x, y: offset.y - scroll.y};
		var relativePosition = (relative && (relative = $(relative))) ? relative.getPosition() : {x: 0, y: 0};

        if (Browser.Engine.presto925) {
            var position = {x: offset.x, y: offset.y};
        }

		return {x: position.x - relativePosition.x, y: position.y - relativePosition.y};
	},

                  Changed 4 weeks ago by hthetiot

          status
              changed from closed to reopened
        
          resolution
            deleted

bug allways here : 

to fix : 

	getPosition: function(relative){
		if (isBody(this)) return {x: 0, y: 0};
		var offset = this.getOffsets(), scroll = this.getScrolls();
		var position = {x: offset.x - scroll.x, y: offset.y - scroll.y};
		var relativePosition = (relative && (relative = $(relative))) ? relative.getPosition() : {x: 0, y: 0};

        if (Browser.Engine.presto925) {
            var position = {x: offset.x, y: offset.y};
        }

		return {x: position.x - relativePosition.x, y: position.y - relativePosition.y};
	},

          status
              changed from closed to reopened
        
          resolution
            deleted
        
      

Changed 4 weeks ago by moro


        
duplicate of http://dev.mootools.net/ticket/912 and http://dev.mootools.net/ticket/813 

      

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

Tags

Pages