From 0f6a7e0776483099cd7c902de73264e03e4358f3 Mon Sep 17 00:00:00 2001 From: Ghost-017 <31908292+Ghost-017@users.noreply.github.com> Date: Wed, 19 Sep 2018 20:37:25 +0800 Subject: [PATCH] Typo changes - HTML is not really a language - I'd prefer to use the word 'parse' because it means, "The process of analyzing text made of a sequence of tokens to determine its grammatical structure ... . The parser then builds a data structure ... for compilers, interpreters or translators to create an executable program or library." Instead of just reading them. https://stackoverflow.com/questions/2933192/what-is-parsing-in-terms-that-a-new-programmer-would-understand --- .../06-dom-attributes-and-properties/article.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/2-ui/1-document/06-dom-attributes-and-properties/article.md b/2-ui/1-document/06-dom-attributes-and-properties/article.md index 8c082cb6..c1bcf2ce 100644 --- a/2-ui/1-document/06-dom-attributes-and-properties/article.md +++ b/2-ui/1-document/06-dom-attributes-and-properties/article.md @@ -1,6 +1,6 @@ # Attributes and properties -When the browser loads the page, it "reads" (another word: "parses") HTML text and generates DOM objects from it. For element nodes most standard HTML attributes automatically become properties of DOM objects. +When the browser loads the page, it "reads" (another word: "parses") the HTML and generates DOM objects from it. For element nodes, most standard HTML attributes automatically become properties of DOM objects. For instance, if the tag is ``, then the DOM object has `body.id="page"`. @@ -51,7 +51,7 @@ So, DOM properties and methods behave just like those of regular JavaScript obje ## HTML attributes -In HTML language, tags may have attributes. When the browser reads HTML text and creates DOM objects for tags, it recognizes *standard* attributes and creates DOM properties from them. +In HTML, tags may have attributes. When the browser parses the HTML to create DOM objects for tags, it recognizes *standard* attributes and creates DOM properties from them. So when an element has `id` or another *standard* attribute, the corresponding property gets created. But that doesn't happen if the attribute is non-standard. @@ -83,9 +83,9 @@ Here we can see it: ``` -So, if an attribute is non-standard, there won't be DOM-property for it. Is there a way to access such attributes? +So, if an attribute is non-standard, there won't be a DOM-property for it. Is there a way to access such attributes? -Sure. All attributes are accessible using following methods: +Sure. All attributes are accessible by using the following methods: - `elem.hasAttribute(name)` -- checks for existence. - `elem.getAttribute(name)` -- gets the value. @@ -138,7 +138,7 @@ Please note: 1. `getAttribute('About')` -- the first letter is uppercase here, and in HTML it's all lowercase. But that doesn't matter: attribute names are case-insensitive. 2. We can assign anything to an attribute, but it becomes a string. So here we have `"123"` as the value. 3. All attributes including ones that we set are visible in `outerHTML`. -4. The `attributes` collection is iterable and has all attributes with `name` and `value`. +4. The `attributes` collection is iterable and has all the attributes of the element (standard and non-standard) as objects with `name` and `value` properties. ## Property-attribute synchronization