Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Issue-688 - replaced classList shim with polyfill #690

Merged
merged 2 commits into from
Jun 10, 2019
Merged

Issue-688 - replaced classList shim with polyfill #690

merged 2 commits into from
Jun 10, 2019

Conversation

Matthematic
Copy link
Contributor

Summary

fixes #688 Replaced the classList shim in hookshot with classlist-polyfill

@@ -5,6 +5,7 @@ import KeyCode from 'keycode-js';
import onClickOutside from 'react-onclickoutside';
import ResizeObserver from 'resize-observer-polyfill';
import styles from './HookshotContent.module.scss';
import 'classlist-polyfill'; // Full polyfill for browsers with no classList support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check if the polyfill is already included before importing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The polyfill handles checking if classList is already defined before doing anything, and i thought webpack took care of bundling repeated imports.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, webpack will take care of bundling.

I hate to be a pain, but since we are adding a new third party dependency to our library, I am wondering if we've scoped out the impact. Why did you choose classlist-polyfill over classList.js? Classlist-poyfill mentions they fork classList.js. Does classlist-polyfill have similar issues to whats been logged in classList.js?

Additionally, why did we explore adding the dom4 polyfill suggested by react-outsideclick (the reason we have this shim) instead of classlist-polyfill?

Copy link
Contributor Author

@Matthematic Matthematic May 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

classlist-polyfill is simply a published fork of classList.js. The owner of classList.js chose not to release on npm, but they are the exact same script, and the owner suggests this package themselves. And the reason for not using dom4 was to try and change and little as necessary since dom4 includes polyfills for all sorts of things in addition to classList. And if it means anything, dom4 is also less popular on npm as far as weekly downloads go.

@mjhenkes mjhenkes temporarily deployed to terra-framework-deploye-pr-690 June 4, 2019 14:03 Inactive
Copy link
Contributor

@bjankord bjankord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the deployed PR against our supported browsers on desktop and mobile and it all looks to work correctly. 👍

@Matthematic
Copy link
Contributor Author

@bjankord It says merging is blocked for me since I'm not an authorized user. Are you able to merge this?

@bjankord
Copy link
Contributor

@Matthematic Yeah, this looks good to merge. Thanks for the contribution @Matthematic! 👍

@bjankord bjankord merged commit 55d95c0 into cerner:master Jun 10, 2019
benbcai added a commit that referenced this pull request Jun 11, 2019
* master:
  Update ISSUE_TEMPLATE.md
  Issue-688 - replaced classList shim with polyfill (#690)
  [terra-date-time-picker] Update wdio tests (#720)

# Conflicts:
#	packages/terra-date-time-picker/CHANGELOG.md
#	packages/terra-date-time-picker/tests/wdio/date-time-picker-spec.js
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terra-hookshot uses an incomplete shim for classList which is incompatible with d3js
4 participants