Always target the web events at the currentTarget
Otherwise, when the event bubbles, all of the events are targeted at the 'target', which is not the behavior we observe in browsers. For an event, the following should happen: - Targeting phase (we don't use this for firing events) - The found target should have its event handler fired - If the event's propagation is not prevented, it should bubble. All of the element's parent elements should get a chance to handle the event. These are called 'currentTarget' and this is therefore the actual element we should run the callback on. Change-Id: I6bf8903431c6dea3097a4582acad22c9a4f12469 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
095604c9af
commit
b13405bb34
@ -642,7 +642,7 @@ EventCallback::EventCallback(emscripten::val element, const std::string &name, c
|
|||||||
|
|
||||||
void EventCallback::activate(emscripten::val event)
|
void EventCallback::activate(emscripten::val event)
|
||||||
{
|
{
|
||||||
emscripten::val target = event["target"];
|
emscripten::val target = event["currentTarget"];
|
||||||
std::string eventName = event["type"].as<std::string>();
|
std::string eventName = event["type"].as<std::string>();
|
||||||
emscripten::val property = target[contextPropertyName(eventName)];
|
emscripten::val property = target[contextPropertyName(eventName)];
|
||||||
// This might happen when the event bubbles
|
// This might happen when the event bubbles
|
||||||
|
Loading…
x
Reference in New Issue
Block a user