-
Notifications
You must be signed in to change notification settings - Fork 645
Open
Labels
Description
Scenario
document.observe('dom:load',function(){
$('div1').update('my div')
});
If the element div1
does not exist in the DOM then the js errors and nothing else past that line is ran. The error ends up being cannot read property of null
which is not descriptive. (could be different in different browsers but still not the actual problem)
so question is
- This is expected behavior, devs should wrap the statements in if blocks
- We should throw a better error, "Element with id(s)
div1
does not exist" - Gracefully fail, or return an empty element to prevent the JS error and throw a warning
This applies to Element#down()
as well