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

Element.prototype.scroll{To, By}? #32

Closed
saschanaz opened this issue Jun 16, 2016 · 2 comments
Closed

Element.prototype.scroll{To, By}? #32

saschanaz opened this issue Jun 16, 2016 · 2 comments

Comments

@saschanaz
Copy link

It seems that the latest WD has scroll, scrollTo, scrollBy methods on Element interface. Will this polyfill support them?

partial interface Element {
  ...
  void scroll(optional ScrollToOptions options);
  void scroll(unrestricted double x, unrestricted double y);
  void scrollTo(optional ScrollToOptions options);
  void scrollTo(unrestricted double x, unrestricted double y);
  void scrollBy(optional ScrollToOptions options);
  void scrollBy(unrestricted double x, unrestricted double y);
  ...
};
@jeremenichelli
Copy link
Collaborator

You're right, they are part of the partial spec and are present in the current implementation in Firefox. Right now they are not present in the polyfill. It could be a nice future addition.

ghybs added a commit to ghybs/smoothscroll that referenced this issue Feb 21, 2017
as mentioned in iamdustan#32, `scrollBy` method (and others) has been added to the Element interface as well by latest draft spec.
iamdustan#32
https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
This commit only adds `scrollBy`.
iamdustan pushed a commit that referenced this issue Feb 24, 2017
* Feat(element.scrollBy): added polyfill on Element for scrollBy

as mentioned in #32, `scrollBy` method (and others) has been added to the Element interface as well by latest draft spec.
#32
https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
This commit only adds `scrollBy`.

* Feat(element.scrollBy): added demo on index.html page

to test in different browers right away.

* Feat(element.scroll): added scroll and scrollTo API on Element.prototype

should allow refactoring `scrollBy` and `scrollIntoView` later on.
Would also enable fixing bad fallback for `scrollBy` (in case of bailout).

* Feat(element.scroll): added Element.scroll section in demo page

* Refactor(element.scrollBy): use Element.scroll internally

side effect is that this refactoring eliminates the bad fallback for `Element.scrollBy` (was using `Element.scrollIntoView`, which gives a totally different behavior), and re-uses simply the fallback within `Element.scroll`.

* Feat(dist): updated dist file with Element.scroll

* Refactor(el.scrollBy): do not change input parameter

but use a new object instead.
Since only `left`, `top` and `behavior` object members are used (at least for now), we do not need to actually clone the full input parameter; just using those 3 members keeps the code simple.

* Refactor(el.scrollBy): update dist file

with refactoring of `Element.prototype.scrollBy` so that it does not change the input argument / parameter.
@jeremenichelli
Copy link
Collaborator

Confirming this was added a while ago, though there are some bugs and inconsistency that I'm going to tackle in the following days.

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

2 participants