Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13457 closed bug (invalid)

Different Values for $('#foo').position().left in Firefox and Chrome

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: offset Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by mikesherov)

<!doctype>
<html>
  <head>
    <title>Test</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function (){
      console.log($('#container').position().left)
      $(window).on('resize', function () {
        console.log($('#container').position().left)
      })
    })
    </script>
    <style>
    #main {
      position: relative;
      width: 100%;
    }
    #container {
      height: 100%;
      position: relative;
      margin: auto;
      width: 960px;
    }
    </style>
  </head>
  <body>
  <div id="main">
    <div id="container">hello</div>
  </div>
  </body>
</html>

Change History (6)

comment:1 Changed 10 years ago by [email protected]

On Chrome $('#container').position().left ignores the margin on the container.

In firefox $('#container').position().left takes into account the margin.

comment:2 Changed 10 years ago by mikesherov

Component: unfiledoffset
Owner: set to mikesherov
Priority: undecidedlow
Status: newassigned

comment:3 Changed 10 years ago by mikesherov

Description: modified (diff)

comment:4 Changed 10 years ago by mikesherov

Owner: changed from mikesherov to [email protected]
Status: assignedpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.

I even tried to use the test case you provided in the comments and couldn't reproduce the bug as described: http://jsbin.com/amatud/3/edit

comment:5 Changed 10 years ago by mikesherov

Also, noticed you were using an invalid doctype, but even changing that to a proper one doesn't reproduce the issue.

comment:6 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.