Browse Source
Assigning `null` to handlers removes them, this mimic the behaviour from Google Chrome. From Chrome's Developer Tools: ```js > function handler(evt) { console.log('img handler: %s', evt.type); } < undefined > var img = document.createElement('img') < undefined > img.onload = handler < handler(evt) > img.onerror = handler < handler(evt) > img.src = 'https://www.google.com/images/errors/logo_sm_2.png'; true < true < img handler: load > img.src = 'https://www.google.com/images/errors/logo_sm_2.png'; true < true < img handler: load > img.src = 'https://example.com/404.png'; true < true < img handler: error > img.src = 'https://example.com/404.png'; true < true < img handler: error > img.onload = null < null > img.onerror = null < null > img.src = 'https://www.google.com/images/errors/logo_sm_2.png'; true < true > img.src = 'https://example.com/404.png'; true < true ```v1.x
Raul Ochoa
10 years ago
committed by
Linus Unnebäck
2 changed files with 64 additions and 0 deletions
Loading…
Reference in new issue