JaeYeopHan / tip-archive

📦 Archiving various development tips. If you watch this repository, you can get issues related to the newly registered development tip from the GitHub feed.
https://www.facebook.com/Jbee.dev/
245 stars 8 forks source link

Until IE Dead #75

Open JaeYeopHan opened 3 years ago

JaeYeopHan commented 3 years ago

1. Table border-collapse issue

/*
  when border-collapse is 'collapse',
  cannot apply border style to th, tr element
  so...
*/

export const tableBorderWhenIE = isIE()
  ? css`
      border-collapse: separate;
      border-spacing: 0;
    `
  : null;
JaeYeopHan commented 3 years ago

2. File download

image

https://gist.github.com/hutch120/99469b8caf661b427f42b7055518e5a4#file-download-js-L59

JaeYeopHan commented 3 years ago

3. Element.scrollTo

image

interface Options {
  x?: number;
  y?: number;
  behavior?: 'smooth';
}

export function elementScrollTo(element: Element, { x, y, behavior }: Options) {
  if (isIE()) {
    if (x != null) {
      element.scrollLeft = x;
    }
    if (y != null) {
      element.scrollTop = y;
    }
    return;
  }
  element.scrollTo({ left: x, top: y, behavior });
}