[Webkit-unassigned] [Bug 197978] New: event.target as null if element is not in DOM and console.log it through setTimeout

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 17 00:12:29 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=197978

            Bug ID: 197978
           Summary: event.target as null if element is not in DOM and
                    console.log it through setTimeout
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: kievsash at ukr.net

### Current Behavior
if element not in dom and I trigger keyup event and in handler want to console.log event.target in setTimeout - I see event.target === null
Reproduced in Chrome (Version 74.0.3729.157 (Official Build) (64-bit)) and Opera(Version:58.0.3135.132) but works well in FF.

###Here is a code to reproduce:
const mockInput = document.createElement('input');
//document.body.appendChild(mockInput);
mockInput.value = 'test';
mockInput.dispatchEvent(new KeyboardEvent('keyup', {'key': 'y'}));

mockInput.addEventListener('keyup', (event) => {
  console.log('event target1', event.target) // see element
  setTimeout(() => {console.log('event target2', event.target)}, 10) // see null in Chrome and Opera
})

mockInput.dispatchEvent(new KeyboardEvent('keyup', {'key': 'y'}));

###And codepen:
https://codepen.io/kievsash/pen/pmPQrJ?editors=0010

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190517/00509ee5/attachment-0001.html>


More information about the webkit-unassigned mailing list