Skip to content

Commit ba88b60

Browse files
committed
closes #1852
1 parent f0bd80c commit ba88b60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2-ui/2-events/03-event-delegation/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ table.onclick = function(event) {
101101

102102
Explanations:
103103
1. The method `elem.closest(selector)` returns the nearest ancestor that matches the selector. In our case we look for `<td>` on the way up from the source element.
104-
2. If `event.target` is not inside any `<td>`, then the call returns `null`, and we don't have to do anything.
105-
3. In case of nested tables, `event.target` may be a `<td>` lying outside of the current table. So we check if that's actually *our table's* `<td>`.
104+
2. If `event.target` is not inside any `<td>`, then the call returns immediately, as there's nothing to do.
105+
3. In case of nested tables, `event.target` may be a `<td>`, but lying outside of the current table. So we check if that's actually *our table's* `<td>`.
106106
4. And, if it's so, then highlight it.
107107

108108
As the result, we have a fast, efficient highlighting code, that doesn't care about the total number of `<td>` in the table.

0 commit comments

Comments
 (0)