New issue
Advanced search Search tips

Issue 703668 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 223749
Owner: ----
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

window.even is available in any DOM event handler although is not defined

Reported by zayan...@gmail.com, Mar 21 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36

Steps to reproduce the problem:
1. Any function that handle DOM events, example:
document.body.onclick=function(e) { console.log(event); }
2. click event is triggered
3. the console log a MouseEvent Object

What is the expected behavior?
Should give an error
(Uncaught ReferenceError: event is not defined) 

What went wrong?
This proprietary is non-standard, and Chrome supports it because of compatibility to old IE, but at least the developer should be warn of this non-standard usage, or given an error to be more compliant with standards.

Did this work before? N/A 

Chrome version: 57.0.2987.98  Channel: stable
OS Version: 10.0
Flash Version: 

Developers could use the proprietary without intention to use it, example using 'e' in the function declaration but 'event' inside the function, example:
document.body.onclick=function(e) { console.log(event); }
 
Cc: paulir...@chromium.org
Components: -Blink Blink>Bindings
I'm not sure this is really actionable due to the way bindings work on the window object as this is standard behavior. But you wish us to warn that they are doing something inappropriate.

paulirish@ is this something that lighthouse/devtools audit can warn for?

Comment 2 by tkent@chromium.org, Mar 21 2017

Mergedinto: 223749
Status: Duplicate (was: Unconfirmed)

Sign in to add a comment