From 6f7747412892af18bef82628df35e93c0fc24485 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Fri, 6 Mar 2020 09:57:40 +0200 Subject: [PATCH] Update some browser snippet descriptions --- snippets/currentURL.md | 4 ++-- snippets/insertAfter.md | 5 +++-- snippets/insertBefore.md | 5 +++-- snippets/setStyle.md | 7 ++++--- snippets/toggleClass.md | 7 ++++--- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/snippets/currentURL.md b/snippets/currentURL.md index a8eb34eac..173fffda1 100644 --- a/snippets/currentURL.md +++ b/snippets/currentURL.md @@ -5,7 +5,7 @@ tags: browser,url,beginner Returns the current URL. -Use `window.location.href` to get current URL. +Use `window.location.href` to get the current URL. ```js const currentURL = () => window.location.href; @@ -13,4 +13,4 @@ const currentURL = () => window.location.href; ```js currentURL(); // 'https://google.com' -``` \ No newline at end of file +``` diff --git a/snippets/insertAfter.md b/snippets/insertAfter.md index 7b105279a..695e9455e 100644 --- a/snippets/insertAfter.md +++ b/snippets/insertAfter.md @@ -12,5 +12,6 @@ const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlSt ``` ```js -insertAfter(document.getElementById('myId'), '

after

'); //
...

after

-``` \ No newline at end of file +insertAfter(document.getElementById('myId'), '

after

'); +//
...

after

+``` diff --git a/snippets/insertBefore.md b/snippets/insertBefore.md index 3a0f52f21..dc20ba6ca 100644 --- a/snippets/insertBefore.md +++ b/snippets/insertBefore.md @@ -12,5 +12,6 @@ const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', ht ``` ```js -insertBefore(document.getElementById('myId'), '

before

'); //

before

...
-``` \ No newline at end of file +insertBefore(document.getElementById('myId'), '

before

'); +//

before

...
+``` diff --git a/snippets/setStyle.md b/snippets/setStyle.md index 4f7aa64ab..0619d57e7 100644 --- a/snippets/setStyle.md +++ b/snippets/setStyle.md @@ -3,7 +3,7 @@ title: setStyle tags: browser,beginner --- -Sets the value of a CSS rule for the specified element. +Sets the value of a CSS rule for the specified HTML element. Use `element.style` to set the value of the CSS rule for the specified element to `val`. @@ -12,5 +12,6 @@ const setStyle = (el, ruleName, val) => (el.style[ruleName] = val); ``` ```js -setStyle(document.querySelector('p'), 'font-size', '20px'); // The first

element on the page will have a font-size of 20px -``` \ No newline at end of file +setStyle(document.querySelector('p'), 'font-size', '20px'); +// The first

element on the page will have a font-size of 20px +``` diff --git a/snippets/toggleClass.md b/snippets/toggleClass.md index 3beb7f574..6dfbecc84 100644 --- a/snippets/toggleClass.md +++ b/snippets/toggleClass.md @@ -3,7 +3,7 @@ title: toggleClass tags: browser,beginner --- -Toggle a class for an element. +Toggles a class for an HTML element. Use `element.classList.toggle()` to toggle the specified class for the element. @@ -12,5 +12,6 @@ const toggleClass = (el, className) => el.classList.toggle(className); ``` ```js -toggleClass(document.querySelector('p.special'), 'special'); // The paragraph will not have the 'special' class anymore -``` \ No newline at end of file +toggleClass(document.querySelector('p.special'), 'special'); +// The paragraph will not have the 'special' class anymore +```