- Notifications
You must be signed in to change notification settings - Fork230
Node properties: type, tag and contents#422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
joaquinelio merged 21 commits intojavascript-tutorial:masterfromhomero304:Node-properties_type-tag-and-contentsOct 15, 2020
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
21 commits Select commitHold shift + click to select a range
7c9c530
Node properties: type, tag and contents
omero32907d71cc
Merge branch 'master' into Node-properties_type-tag-and-contents
omero329b7db859
Update 2-ui/1-document/05-basic-dom-node-properties/2-tree-info/solut…
omero329ce97b25
Update 2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/…
omero32979e0683
Update 2-ui/1-document/05-basic-dom-node-properties/4-where-document-…
omero3295077fca
Update 2-ui/1-document/05-basic-dom-node-properties/4-where-document-…
omero32910b54a5
Update 2-ui/1-document/05-basic-dom-node-properties/4-where-document-…
omero329872e7f4
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero3298e92100
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero3298c3fb5b
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero32979a79be
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero329b54440b
Winnie-pooh
omero329c313b2c
Merge branch 'Node-properties_type-tag-and-contents' of https://githu…
omero329dc34f25
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero329b7fd044
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero329ed04f67
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero3293be53c7
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero329c040d70
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero3292a3803b
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
omero329e79bc49
integrada -> nativa
omero3290c5fede
Merge branch 'Node-properties_type-tag-and-contents' of https://githu…
omero329File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions...1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,9 +2,9 @@ importance: 5 | ||
--- | ||
#¿Qué hay en nodeType? | ||
¿Qué muestra el script? | ||
```html | ||
<html> | ||
10 changes: 5 additions & 5 deletions2-ui/1-document/05-basic-dom-node-properties/2-tree-info/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
Hagamos un ciclo sobre `<li>`: | ||
```js | ||
for (let li of document.querySelectorAll('li')) { | ||
... | ||
} | ||
``` | ||
En el ciclo, necesitamos introducir el texto dentro de cada `li`. | ||
Podemos leer el texto del primer nodo hijo de`li`,que es el nodo de texto: | ||
```js | ||
for (let li of document.querySelectorAll('li')) { | ||
let title = li.firstChild.data; | ||
//el título es el texto en<li>antes de cualquier otro nodo | ||
} | ||
``` | ||
Entonces podemos obtener el número de descendientes como `li.getElementsByTagName('li').length`. |
36 changes: 18 additions & 18 deletions2-ui/1-document/05-basic-dom-node-properties/2-tree-info/solution.view/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions2-ui/1-document/05-basic-dom-node-properties/2-tree-info/source.view/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions2-ui/1-document/05-basic-dom-node-properties/2-tree-info/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions...document/05-basic-dom-node-properties/4-where-document-in-hierarchy/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
Podemos ver a qué clase pertenece, imprimiéndola, así: | ||
```js run | ||
alert(document); // [object HTMLDocument] | ||
``` | ||
O: | ||
```js run | ||
alert(document.constructor.name); // HTMLDocument | ||
``` | ||
Entonces, `document`es una instancia de la clase`HTMLDocument`. | ||
¿Cuál es su lugar en la jerarquía? | ||
Sí, podríamos examinar las especificaciones, pero sería más rápido averiguarlo manualmente. | ||
Recorramos la cadena deprototypetravés de `__proto__`. | ||
Como sabemos, los métodos de una clase están en el`prototype`delconstructor.Por ejemplo, `HTMLDocument.prototype`tiene métodos para documentos. | ||
Además, hay una referencia a la funciónconstructordentro de `prototype`: | ||
```js run | ||
alert(HTMLDocument.prototype.constructor === HTMLDocument); // true | ||
``` | ||
Para obtener un nombre de la clase comostring,podemos usar`constructor.name`.Hagámoslo para toda la cadena prototype de`document`, hasta la clase `Node`: | ||
```js run | ||
alert(HTMLDocument.prototype.constructor.name); // HTMLDocument | ||
alert(HTMLDocument.prototype.__proto__.constructor.name); // Document | ||
alert(HTMLDocument.prototype.__proto__.__proto__.constructor.name); // Node | ||
``` | ||
Esa es la jerarquía. | ||
También podríamos examinar el objeto usando`console.dir(document)`y ver estos nombres abriendo`__proto__`.La consola los toma del `constructor`internamente. |
8 changes: 4 additions & 4 deletions2-ui/1-document/05-basic-dom-node-properties/4-where-document-in-hierarchy/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.