Add a check for custom events in dispatch event #16869
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-obsolete
Closed as the reported issue is no longer relevant
library-html
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @chalin
What steps will reproduce the problem?
// Context: import 'dart:html' as dom;
var element = dom.querySelector(...);
var ev = new KeyEvent('keypress', keyCode: 65);
2. print("ev=$ev, and (ev is Event) is ${ev is Event}");
==> output: ev=Instance of 'KeyEvent', and (ev is Event) is true
3. element.dispatchEvent(ev);
==> yields
Caught Invalid class: expected instance of Event
#0 Node.dispatchEvent (.../dart/dart/html/Node.dart:586)
What is the expected output? What do you see instead?
The exception reports that
ev
is not an instance ofEvent
and yet from the printed output we see that it is.What version of the product are you using? On what operating system?
Dartium Version 33.0.1750.48 (251129)
Dart VM version: 1.2.0-dev.4.0 (Fri Feb 7 10:19:23 2014) on "macos_x64"
Please provide any additional information below.
The problem might be that KeyEvents cannot be dispatched for some other reason, and if so, then the thrown exception message should be changed.
The text was updated successfully, but these errors were encountered: