|
5 | 5 | ---
|
6 | 6 |
|
7 | 7 |
|
8 |
| -# Walking the DOM |
| 8 | +# Dom'da gezinme |
9 | 9 |
|
10 |
| -The DOM allows us to do anything with elements and their contents, but first we need to reach the corresponding DOM object. |
| 10 | +DOM, elementler ve içerikleri ile her şeyi yapmamıza izin verir, ancak önce ilgili DOM nesnesine ulaşmamız gerekir. |
11 | 11 |
|
12 |
| -All operations on the DOM start with the `document` object. From it we can access any node. |
| 12 | +DOM üzerindeki tüm işlemler `document` nesnesiyle başlar. Bu nesneden herhangi bir düğüme erişebiliriz. |
13 | 13 |
|
14 |
| -Here's a picture of links that allow for travel between DOM nodes: |
| 14 | +DOM düğümleri arasında dolaşmaya izin veren bağlantıların bir görüntüsü: |
15 | 15 |
|
16 | 16 | 
|
17 | 17 |
|
18 |
| -Let's discuss them in more detail. |
| 18 | +Bunlara daha ayrıntılı değinelim. |
19 | 19 |
|
20 |
| -## On top: documentElement and body |
| 20 | +## Üstte: documentElement ve body |
21 | 21 |
|
22 |
| -The topmost tree nodes are available directly as `document` properties: |
| 22 | +En üstteki ağaç düğümleri doğrudan `document` özellikleri olarak kullanılabilir: |
23 | 23 |
|
24 | 24 | `<html>` = `document.documentElement`
|
25 |
| -: The topmost document node is `document.documentElement`. That's DOM node of `<html>` tag. |
| 25 | +: En üstteki belge düğümü `document.documentElement`'tir. Bu, `<html>` etiketinin DOM düğümüdür. |
26 | 26 |
|
27 | 27 | `<body>` = `document.body`
|
28 |
| -: Another widely used DOM node is the `<body>` element -- `document.body`. |
| 28 | +: Yaygın olarak kullanılan başka bir DOM düğümü, `<body>` elementidir -- `document.body`. |
29 | 29 |
|
30 | 30 | `<head>` = `document.head`
|
31 |
| -: The `<head>` tag is available as `document.head`. |
| 31 | +: `<head>` etiketi `document.head` olarak mevcuttur. |
32 | 32 |
|
33 |
| -````warn header="There's a catch: `document.body` can be `null`" |
34 |
| -A script cannot access an element that doesn't exist at the moment of running. |
35 | 33 |
|
36 |
| -In particular, if a script is inside `<head>`, then `document.body` is unavailable, because the browser did not read it yet. |
37 | 34 |
|
38 |
| -So, in the example below the first `alert` shows `null`: |
| 35 | +````warn header="Bir yakalama var: `document.body`, `null` olabilir." |
| 36 | +Bir komut dosyası (script), çalışma anında mevcut olmayan bir öğeye erişemez. |
| 37 | + |
| 38 | +Özellikle, bir komut dosyası `<head>` içindeyse, tarayıcı henüz okumadığı için `document.body` kullanılamaz. |
| 39 | + |
| 40 | +Bu nedenle, aşağıdaki örnekte ilk `alert` `null` gösterir: |
39 | 41 |
|
40 | 42 | ```html run
|
41 | 43 | <html>
|
|
0 commit comments