URL: http://github.com/javascript-tutorial/uk.javascript.info/pull/260.patch
HTMLInputElement` -- this class provides input-specific properties, -- `HTMLElement` -- it provides common HTML element methods (and getters/setters), -- `Element` -- provides generic element methods, -- `Node` -- provides common DOM node properties, -- `EventTarget` -- gives the support for events (to be covered), -- ...and finally it inherits from `Object`, so "plain object" methods like `hasOwnProperty` are also available. +- `HTMLInputElement` -- цей клас забезпечує специфічні властивості введення, +- `HTMLElement` -- цей клас забезпечує загальні методи HTML-елементів (і гетери/сетери), +- `Element` -- забезпечує загальні методи елемента, +- `Node` -- забезпечує спільні властивості DOM вузлів, +- `EventTarget` -- дає підтримку подій (будуть розглянуті), +- ... і, нарешті, цей клас наслідує `Object`, тому "прості методи об'єкта" такими є, наприклад, `hasOwnProperty` також доступні. -To see the DOM node class name, we can recall that an object usually has the `constructor` property. It references the class constructor, and `constructor.name` is its name: +Щоб побачити назву класу DOM вузла, ми можемо згадати, що об'єкт, як правило, має властивість `constructor`. Вона посилається на конструктор класу, а `constructor.name` - це його назва: ```js run alert( document.body.constructor.name ); // HTMLBodyElement ``` -...Or we can just `toString` it: +...Або ми можемо просто викликати `toString`: ```js run alert( document.body ); // [object HTMLBodyElement] From 8ed8db0df7bfeced8c9fd0918fda53a885da3f48 Mon Sep 17 00:00:00 2001 From: Mykola SopihaA new element
`. In the outer document (the DOM) we can see the new content instead of the `Новий елемент
`. У зовнішньому документі (DOM) ми можемо побачити новий вміст замість `A new element
` was inserted in its place. -- `div` still has its old value. The new HTML wasn't saved to any variable. +Отже, в `div.outerHTML=...` сталося наступне: +- `div` був видалений з документа. +- Інший шматок HTML `Новий елемент
` був вставлений на його місце. +- `div` ще має своє старе значення. Новий HTML не був збережений для будь-якої змінної. -It's so easy to make an error here: modify `div.outerHTML` and then continue to work with `div` as if it had the new content in it. But it doesn't. Such thing is correct for `innerHTML`, but not for `outerHTML`. +Тут так легко зробити помилку: змініть `div.outerHTML`, а потім продовжуйте працювати з `div` так, наче від має новий вміст у собі. Але це не так. Така річ є правильною для `innerHTML`, але не для `outerHTML`. -We can write to `elem.outerHTML`, but should keep in mind that it doesn't change the element we're writing to ('elem'). It puts the new HTML in its place instead. We can get references to the new elements by querying the DOM. +Ми можемо записати в `elem.outerHTML`, але слід пам'ятати, що це не змінює елемент, в який ми пишемо ('elem'). Це вставить замість цього новий HTML. Ми можемо отримати посилання на нові елементи, запитуючи DOM. -## nodeValue/data: text node content +## nodeValue/data: вміст тексту вузла -The `innerHTML` property is only valid for element nodes. +Властивість `innerHTML` існує лише для вузлів-елементів. -Other node types, such as text nodes, have their counterpart: `nodeValue` and `data` properties. These two are almost the same for practical use, there are only minor specification differences. So we'll use `data`, because it's shorter. +Інші типи вузлів, такі як текстові вузли, мають свій аналог: `nodeValue` і `data` властивості. Ці дві властивості майже однакові для практичного використання, є лише незначні відмінності в специфікації. Таким чином, ми будемо використовувати `data`, тому що це коротше. -An example of reading the content of a text node and a comment: +Приклад читання вмісту текстового вузла та коментаря: ```html run height="50" - Hello - + Привіт + ``` -For text nodes we can imagine a reason to read or modify them, but why comments? +Для текстових вузлів ми можемо уявити собі причину читати або змінити їх, але чому коментарі? -Sometimes developers embed information or template instructions into HTML in them, like this: +Іноді розробники вбудовують інформацію або інструкції в шаблон HTML, як наприклад: ```html -Martians attack people!
+Марсіанці нападають на людей!