You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the section "Sortable Lists" of the "Manipulating pages" chapter, the first JavaScript code presents a typo, using document.querySelectorAll('#sorted')) where it should be (as later explained in the same section) document.querySelectorAll('.sorted')).
After changing that typo, the initial example (using onload for the body) does produce sorted lists, which the book emphasises should not have happened still (but only after we use the DOMContentLoaded event).
Due to the fact that it's not always the case that the DOMContentLoaded event occurs before the load one, a possible way to fix this example/section could be to change the typo (using .sorted) but not including the onload attribute for the body element.
The text was updated successfully, but these errors were encountered:
In the section "Sortable Lists" of the "Manipulating pages" chapter, the first JavaScript code presents a typo, using
document.querySelectorAll('#sorted'))
where it should be (as later explained in the same section)document.querySelectorAll('.sorted'))
.After changing that typo, the initial example (using
onload
for the body) does produce sorted lists, which the book emphasises should not have happened still (but only after we use theDOMContentLoaded
event).Due to the fact that it's not always the case that the
DOMContentLoaded
event occurs before theload
one, a possible way to fix this example/section could be to change the typo (using.sorted)
but not including theonload
attribute for the body element.The text was updated successfully, but these errors were encountered: