Skip to content

Commit

Permalink
Merge pull request #19 from andreasremdt/improve-browser-support
Browse files Browse the repository at this point in the history
feat(translator): convert NodeList into an array
  • Loading branch information
andreasremdt authored Aug 4, 2020
2 parents c8cba51 + 7124a72 commit 78b5648
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.2] - 2020-08-04

### Changed

- Added compatibility for older browsers (including Safari 9) by using `Array.from` to convert a NodeList into an array.

## [2.0.1] - 2020-07-30

### Changed
Expand All @@ -28,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `remove()` to remove languages from the translator.
- Added `translateForKey()` and `translatePageTo()` to translate single keys or the entire website.
- Added `get currentLanguage` to get the currently used language.
- Transpiled and minified UMD, ESM and CJS builds are available via [unpkg](https://unpkg.com/@andreasremdt/simple-translator@2.0.0/dist/umd/translator.min.js) and [npm](https://www.npmjs.com/package/@andreasremdt/simple-translator).
- Transpiled and minified UMD, ESM and CJS builds are available via [unpkg](https://unpkg.com/@andreasremdt/simple-translator@latest/dist/umd/translator.min.js) and [npm](https://www.npmjs.com/package/@andreasremdt/simple-translator).
- Added a build system for easier packaging and testing.
- Added [CONTRIBUTING.md](https://github.com/andreasremdt/simple-translator/CONTRIBUTING.md)
- Added [CODE_OF_CONDUCT.md](https://github.com/andreasremdt/simple-translator/CODE_OF_CONDUCT.md)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ A UMD build is available via [unpkg](https://unpkg.com). Just paste the followin

```html
<script
src="https://unpkg.com/@andreasremdt/simple-translator@2.0.0/dist/umd/translator.min.js"
src="https://unpkg.com/@andreasremdt/simple-translator@latest/dist/umd/translator.min.js"
defer
></script>
```
Expand Down Expand Up @@ -96,7 +96,7 @@ Want to see the bigger picture? Check out the live demos at CodeSandbox and see

<!-- Load the translator either from a CDN or locally -->
<script
src="https://unpkg.com/@andreasremdt/simple-translator@2.0.0/dist/umd/translator.min.js"
src="https://unpkg.com/@andreasremdt/simple-translator@latest/dist/umd/translator.min.js"
defer
></script>
<script defer>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@andreasremdt/simple-translator",
"version": "2.0.1",
"version": "2.0.2",
"description": "Simple client-side translation with pure JavaScript.",
"main": "dist/cjs/translator.min.js",
"module": "dist/esm/translator.min.js",
Expand Down
2 changes: 1 addition & 1 deletion src/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Translator {

const elements =
typeof this.config.selector == 'string'
? document.querySelectorAll(this.config.selector)
? Array.from(document.querySelectorAll(this.config.selector))
: this.config.selector;

if (elements.length && elements.length > 0) {
Expand Down

0 comments on commit 78b5648

Please sign in to comment.