Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@



<<<<<<< HEAD
- بىر تور بەتتىكى JavaScript قاتتىق دىسكىدا خالىغانچە ھۆججەتلەرنى ئوقۇمايدۇ/ يازمايدۇ، كۆچۈرۈپ چاپلىمايدۇ ياكى پىروگراممىلارنى ئىجرا قىلمايدۇ. ئۇنىڭ OS (مەشغۇلات سىستېمىسى) ئىقتىدارىغا بىۋاسىتە كىرىش ئىجازىتى يوق.
=======
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com`, for example, and steal information from there.
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is severely limited. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
>>>>>>> 725653fd99b19d42195e837ac3bb23c1784f8f6e

ھازىرقى زامان تور كۆرگۈچلەر ھۆججەتلەرنى ئىشلىتىشكە يول قويىدۇ، ئەمما زىيارەت قىلىش چەكلىك ھەم پەقەت ئىشلەتكۈچى مەلۇم مەشغۇلاتلارنى قىلغاندىلا ئاندىن بۇ ئىقتىدارنى تەمىنلەيدۇ، مەسىلەن، ھۆججەتنى تور كۆرگۈچ كۆزنىكىگە «تاشلاش» ياكى `<input>` خەتكۈش ئارقىلىق تاللاش دېگەندەك.

Expand Down
12 changes: 6 additions & 6 deletions 2-ui/99-ui-misc/01-mutation-observer/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ Such snippet in an HTML markup looks like this:
...
```

For better readability and at the same time, to beautify it, we'll be using a JavaScript syntax highlighting library on our site, like [Prism.js](https://prismjs.com/). To get syntax highlighting for above snippet in Prism, `Prism.highlightElem(pre)` is called, which examines the contents of such `pre` elements and adds special tags and styles for colored syntax highlighting into those elements, similar to what you see in examples here, on this page.
For better readability and at the same time, to beautify it, we'll be using a JavaScript syntax highlighting library on our site, like [Prism.js](https://prismjs.com/). To get syntax highlighting for above snippet in Prism, `Prism.highlightElement(pre)` is called, which examines the contents of such `pre` elements and adds special tags and styles for colored syntax highlighting into those elements, similar to what you see in examples here, on this page.

When exactly should we run that highlighting method? Well, we can do it on `DOMContentLoaded` event, or put the script at the bottom of the page. The moment our DOM is ready, we can search for elements `pre[class*="language"]` and call `Prism.highlightElem` on them:
When exactly should we run that highlighting method? Well, we can do it on `DOMContentLoaded` event, or put the script at the bottom of the page. The moment our DOM is ready, we can search for elements `pre[class*="language"]` and call `Prism.highlightElement` on them:

```js
// highlight all code snippets on the page
document.querySelectorAll('pre[class*="language"]').forEach(Prism.highlightElem);
document.querySelectorAll('pre[class*="language"]').forEach(elem => Prism.highlightElement(elem));
```

Everything's simple so far, right? We find code snippets in HTML and highlight them.
Expand All @@ -146,9 +146,9 @@ let article = /* fetch new content from server */
articleElem.innerHTML = article;
```

The new `article` HTML may contain code snippets. We need to call `Prism.highlightElem` on them, otherwise they won't get highlighted.
The new `article` HTML may contain code snippets. We need to call `Prism.highlightElement` on them, otherwise they won't get highlighted.

**Where and when to call `Prism.highlightElem` for a dynamically loaded article?**
**Where and when to call `Prism.highlightElement` for a dynamically loaded article?**

We could append that call to the code that loads an article, like this:

Expand All @@ -158,7 +158,7 @@ articleElem.innerHTML = article;

*!*
let snippets = articleElem.querySelectorAll('pre[class*="language-"]');
snippets.forEach(Prism.highlightElem);
snippets.forEach(elem => Prism.highlightElement(elem));
*/!*
```

Expand Down