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

Consider making a common package for browser utility functions #1104

Closed
kfranqueiro opened this issue Aug 9, 2017 · 3 comments
Closed

Consider making a common package for browser utility functions #1104

kfranqueiro opened this issue Aug 9, 2017 · 3 comments

Comments

@kfranqueiro
Copy link
Contributor

I noticed we currently have 3 packages (drawer, ripple, toolbar) that define util.applyPassive for detecting passive event support and making use of it, and at least 2 packages (dialog and ripple) that define a function to detect support for custom CSS properties.

This leads to redundant implementation and test code, and in the latter case also has led to the two implementations skewing apart from each other.

We should consider putting common utilities like this in a centralized reusable package. We should also probably check whether there is a reason (other than an oversight) why supportsCssCustomProperties in dialog's util hasn't kept up with the edge cases added to ripple's util.

@Spetnik
Copy link

Spetnik commented Oct 24, 2017

My two cents: the lack of such a package threw me for a loop when replacing Array.prototype.find here: 5aa2b6b#diff-ab2630d7dd0cee3811f920a34f5efc3b

I felt like I should create a simple polyfill function (e.g. https://github.com/Spetnik/ie-Array.find/blob/master/README.md) but I really couldn't find a place where it made sense to add it. I would assume that this proposed package would be the perfect place for such a function.

@acdvorak
Copy link
Contributor

acdvorak commented Jan 3, 2018

We don't use polyfills in MDC-Web because we don't want to conflict with other libs or create weird hard-to-trace bugs, but I would love to create a centralized set of ponyfills (similar to polyfills, but without monkey-patching global prototypes) and other common utilities like resize event throttling.

acdvorak added a commit that referenced this issue Sep 5, 2018
…#3515)

Will be used by #3413 and eventually other packages (e.g., for `Element.closest()` ponyfill)

Refs #1104
@jamesmfriedman jamesmfriedman mentioned this issue Sep 26, 2018
49 tasks
@abhiomkar
Copy link
Contributor

We now have applyPassive in @material/dom/events

Closing this.

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

No branches or pull requests

4 participants