Skip to content

Offset: report offset for zero size elements #3167

@poppinlp

Description

@poppinlp

Description

In your document, i find:

Note: jQuery does not support getting the offset coordinates of hidden elements or accounting for borders, margins, or padding set on the body element.

And in your code, it's:

// Make sure element is not hidden (display: none)
if ( rect.width || rect.height ) {
    ...
}

So how about element shown but with 0 width and height? Seems it's belong to hidden element in your code and get wrong offset value.
Is that a feature or issue? Since there may be some chance i need to know a element's offset which is shown but has no size.

Link to test case

http://codepen.io/poppinlp/pen/gMMaEY

In this test case you will see element with no size get wrong offset.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions