1.2.8 • Published 4 years ago

sa-polyfills v1.2.8

Weekly downloads
26
License
ISC
Repository
github
Last release
4 years ago

Front-End polyfills

Some scripts for supporting new opportunities in old browsers. It based on browser detection.
Build folder contains es6 modules for importing into the project.

Installation

npm install sa-polyfills --save

Table of contents

  1. sa-detection
  2. sa-closest
  3. sa-grid-auto-placement

sa-detection

Functions for browser detection

List of functions

isIE10
isIE11
isEdge
isEdgeChromium
isIE10Plus
isIEOrEdge
isSafari
isAppleDevice
isFirefox
isChrome
isOpera

sa-closest

IE 10+ - Element.closest() polyfill

Usage

import { detection } from 'sa-polyfills';
import { Closest } from 'sa-polyfills';

if (detection.isIE10Plus()) new Closest();

sa-grid-auto-placement

IE 10+ - CSS grid cell auto placement

Usage

import { detection } from 'sa-polyfills';
import { GridAutoPlacement } from 'sa-polyfills';

if (detection.isIE10Plus()) {
  new GridAutoPlacement({
    selector: '#grid',
    direction: 'column',
    msGridColumns: '210px 210px 210px',
    msGridRows: '150px 150px 150px',
    gap: 10
  });
};

--------------------------------------------------------------------------

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .item {
    -ms-grid-row: 999;
    -ms-grid-column: 999;
  }
}

List of parameters

selectorGrid element selector
directionDirection of grid
msGridColumnsCSS grid-template-columns for IE
msGridRowsCSS grid-template-rows for IE

Additional

For using CSS grip-gap you need add padding for grid and margin for grid item:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .grid {
    padding: 5px;
  }

  .item {
    margin: 5px;
  }
}
1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago