Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when jquery is on the page, getInitialDimensions() returns incorrect values, causing unStickElement() to set incorrect values #152

Open
rDr4g0n opened this issue Jun 22, 2016 · 0 comments

Comments

@rDr4g0n
Copy link
Contributor

rDr4g0n commented Jun 22, 2016

When jquery is on the page, angular will opt to use it instead of the built in jqlite. jqlite's css() method returns only the style attribute's css. jquery's css() method looks at getComputedStyle() for the values it returns. Both of them may return the wrong value.

This gist demonstrates how this can be a problem when an element has a css class with left: auto. View the HTML in browser and scroll up and down a few times to see the bug happen. Jquery will return "0px", and jqlite returns "", but the true value should be "auto".

With jqlite, an empty string is ok because when unStickValues() is called and an empty string is set for a css value, the property/value pair is ignored and the original css class is applied (in this case, "auto" is used and recomputed).

With jquery, however, unStickElement() will set the incorrect "0px" value. This causes the next stickElement() call to use the "0px" value, which puts the sticky element at the far left of the screen.

Here is a PR addressing the issue. Specifically this fixes the left property, but this bug probably affects other properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant