Travis build: 1053

This commit is contained in:
30secondsofcode
2018-01-06 10:29:39 +00:00
parent f9193bbad9
commit 6ca42534af
2 changed files with 46 additions and 1 deletions

View File

@ -144,6 +144,7 @@ average(1, 2, 3);
* [`arrayToHtmlList`](#arraytohtmllist)
* [`bottomVisible`](#bottomvisible)
* [`copyToClipboard`](#copytoclipboard-)
* [`createElement`](#createelement)
* [`currentURL`](#currenturl)
* [`detectDeviceType`](#detectdevicetype)
* [`elementIsVisibleInViewport`](#elementisvisibleinviewport)
@ -1783,6 +1784,39 @@ copyToClipboard('Lorem ipsum'); // 'Lorem ipsum' copied to clipboard.
<br>[⬆ Back to top](#table-of-contents)
### createElement
Creates an element from a string.
Use `document.createElement()` to create a new element. Set its `innerHTML`
to the string supplied as the argument. Use `ParentNode.firstElementChild` to
return the element version of the string.
```js
const createElement = str => {
const el = document.createElement('div');
el.innerHTML = str;
return el.firstElementChild;
};
```
<details>
<summary>Examples</summary>
```js
const el = createElement(
`<div class="container">
<p>Hello!</p>
</div>`
);
console.log(el.className); // 'container'
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### currentURL
Returns the current URL.

File diff suppressed because one or more lines are too long