+ 2

Why do i get the error"node to be removed is not child of this node"?

The above error is generated when you do few quick taps around or over text inside blue box Everytime the "pointer down" event occurs on clicking ,it selects the element which was created at "pointerend" event handler function,and i am removing that only ,so really confused about what is going on ,any help is appreciated! https://code.sololearn.com/WWRI42C82V8P/?ref=app

2nd Oct 2020, 12:04 PM
Abhay
Abhay - avatar
3 ответов
+ 1
Josh Greig,ty ,but I am not getting any error "cannot read property style of undefined ", the only two error that I get when I click between the space above the text but inside element is cannot read property "0" of undefined at line 55 and "node to be removed is not child of this node" at line 84 when doing quick touches on text or around its edges ,
3rd Oct 2020, 9:06 AM
Abhay
Abhay - avatar
0
As I run your code, I run into errors related to s being undefined. The message is: "Line: 24Uncaught TypeError: Cannot read property 'style' of undefined" It is reproduced by running the code and moving the cursor around the "move me" element. These errors can be fixed by moving the initialization of s to its declaration like below: var s = document.querySelector("span"); /*** this line edited ******/ var arr=[]; t.onpointerdown=(e)=>{ It looks like you edited code since posting your question because I'm unable to reach the "node to be removed is not a child of this node" error after fixing the above unrelated error.
3rd Oct 2020, 2:02 AM
Josh Greig
Josh Greig - avatar
0
Abhay, try it on a laptop to reproduce the bug I found. I tested in Edge 85.0.564.68 (Official build) (64-bit) and Chrome 85.0.4183.121 (Official Build) (64-bit) and reproduced the bug I mentioned earlier every time. I tried reproducing the problem you described using touch screen since line 55 can't be reached without a touch screen event. I'm just unable to trigger the touchend event in my browsers. I have a touch screen on my laptop but it isn't triggering the touchend event when I lift my finger. I'm able to drag the "move me" text with my finger.
3rd Oct 2020, 4:37 PM
Josh Greig
Josh Greig - avatar