`. Untuk sekarang, panjangnya `1`.
+2. Kode skrip kedua berjalan setelah browser bertemu dengan satu `
` lagi, jadi panjangnya `2`.
```html run
First div
@@ -286,10 +284,9 @@ In the example below, there are two scripts.
```
-In contrast, `querySelectorAll` returns a *static* collection. It's like a fixed array of elements.
-
-If we use it instead, then both scripts output `1`:
+Sebaliknya, `querySelectorAll` mengembalikan koleksi statis. Ini seperti *array* dari elemen yang tetap.
+Jika kita menggunakannya, maka keluaran kedua kode skrip adalah `1`:
```html run
First div
@@ -308,12 +305,11 @@ If we use it instead, then both scripts output `1`:
```
-Now we can easily see the difference. The static collection did not increase after the appearance of a new `div` in the document.
-
-## Summary
+Sekarang kita bisa lebih mudah melihat perbedaanya. Koleksi statis tidak bertambah setelah muncul `div` baru di dokumen.
-There are 6 main methods to search for nodes in DOM:
+## Ringkasan
+Terdapat 6 metode utama untuk mencari *node* pada DOM:
@@ -363,12 +359,12 @@ There are 6 main methods to search for nodes in DOM:
-By far the most used are `querySelector` and `querySelectorAll`, but `getElementBy*` can be sporadically helpful or found in the old scripts.
+Sejauh ini yang paling banyak digunakan adalah `querySelector` dan `querySelectorAll`, tetapi `getElementBy*` secara terkadang membantu atau dapat ditemukan pada kode skrip lama.
-Besides that:
+Selain itu:
-- There is `elem.matches(css)` to check if `elem` matches the given CSS selector.
-- There is `elem.closest(css)` to look for the nearest ancestor that matches the given CSS-selector. The `elem` itself is also checked.
+- Terdapat `elem.mathes(css)` untuk memeriksa jika `elem` cocok dengan *selector* CSS.
+- Terdapat `elem.closest(css)` untuk mencari ancestor terdekat yang cocok dengan *selector* CSS yang diberikan. `elem` juga diperiksa.
-And let's mention one more method here to check for the child-parent relationship, as it's sometimes useful:
-- `elemA.contains(elemB)` returns true if `elemB` is inside `elemA` (a descendant of `elemA`) or when `elemA==elemB`.
+Dan mari kita sebutkan satu lagi metode untuk memeriksa hubungan child-*parent*, karena terkadang berguna:
+- `elemA.contains(elemB)` akan mengembalikan true jika `elemB` di dalam `elemA` adalah keturunan `elemA`) dan ketika `elemA==elemB`.
\ No newline at end of file
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy