Giter VIP home page Giter VIP logo

offsetparent-polyfills's People

Contributors

josepharhar avatar

Stargazers

Anne Thorpe avatar JC Franco avatar

Watchers

James Cloos avatar Stefan Ramson avatar  avatar

Forkers

jcfranco

offsetparent-polyfills's Issues

Old offsetLeft and -Top Behavior in Chrome 109

[Continuation of the discussion on chromium bugs regarding the new offset behavior (now aligned with Firefox).]

The upgrade to Chrome 109 seems to have altered the behavior of this polyfill. I'm using isNewBehavior=false, assuming this is the flag for reproducing the old (Chrome <= 108) behavior. In my classical example using offsetLeft and -Top to calculate the anchor points of edge in a graphical editor, elements in shadowroots now return negative values, resulting in unexpected behavior:

chrome_bc5T6XQF45.mp4

For a live example (and live programming environment), you can head to https://lively-kernel.org/lively4/composed-offset/start.html?load=https://lively-kernel.org/lively4/composed-offset/demos/offset/offset-left-top.md (only runs in Chrome).

Some of the values seem to be computed correctly, some do not (the accumulating substraction seems off, or is just applied to the wrong elements (https://github.com/josepharhar/offsetparent-polyfills/blob/main/offsetParent-polyfill.js#L105))

image

Turning isNewBehavior to true has other effects, particularly, not changing the offset of an element when moved. In the below video, the edge in the top left should follow the movement of the node:

isNewBehavior.true.mp4

Very interesting: the offset of a web-component directly in the body still seems to be computed correctly (here 43, 36 for a lively-window) as show in this test (lower is closer to the root):
image
However, a div in the component's shadowroot has the exact same offset, just negative (here -43, -36 for div.window)

Intended behavior on interaction with css filter-property?

"Unsure, where to report this due to many moving parts. I at least know that you are very knowledgeable in this topic."

Browser: Chrome Version 108.0.5359.73 (Offizieller Build) (64-Bit)

I'm using this polyfill (all 3 methods) on a deeply nested element in a recursive manner to walk up the parent chain until a designated parent is found. While walking, we accumulate the offset. I use the result to position another element (an svg path).

While everything works fine, once I set the css property filter on any element in the parent chain (or a child of it), it seems to not contribute to offset computation anymore. This results in the following effect:

chrome_pYggvumWxL.mp4

To reproduce:

My question is if this change in behavior due to the filter property is intentional or not?

According to https://drafts.fxtf.org/filter-effects/#FilterProperty filter inserts a containing block, but I'm unsure, if this should affect offset*.

A value other than none for the filter property results in the creation of a containing block for absolute and fixed positioned descendants unless the element it applies to is a document root element in the current browsing context. The list of functions are applied in the order provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.