Skip to main content

Bug Tracker

Side navigation

#11663 closed bug (patchwelcome)

Opened April 27, 2012 08:19AM UTC

Closed June 02, 2012 06:28PM UTC

Last modified January 16, 2013 01:09PM UTC

Removing an event target during a change event throws NOT_FOUND_ERR

Reported by: Sebmaster Owned by: Sebmaster
Priority: low Milestone: None
Component: event Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

If you bind an event handler via on() on a change event and remove the event target in the event handler via empty() jQuery throws a "Uncaught Error: NOT_FOUND_ERR: DOM Exception 8".

Testcast is at: http://jsfiddle.net/KRvFk/

If you replace the call to empty() with a .innerHTML = '' it behaves as expected.

Testcase: http://jsfiddle.net/KRvFk/1/

Attachments (0)
Change History (9)

Changed April 27, 2012 08:24AM UTC by sindresorhus comment:1

component: unfiledevent
owner: → Sebmaster
priority: undecidedlow
status: newpending

Which browsers are you seeing the problem in?

Changed April 27, 2012 08:36AM UTC by Sebmaster comment:2

status: pendingnew

The error occurs on Chrome 18.0.1025.162 m and Chrome 20.0.1119.0 canary.

It does not occur in Internet Explorer 9 and 10 and Firefox 10.0.0.2.

Changed April 28, 2012 03:46PM UTC by dmethvin comment:3

status: newpending

I do not see an error in Chrome 18.0.1025.162 (What does the "m" mean?)

Can you try it in Incognito mode and see if perhaps an extension is messing things up?

Changed April 28, 2012 06:16PM UTC by Sebmaster comment:4

status: pendingnew

Replying to [comment:3 dmethvin]:

I do not see an error in Chrome 18.0.1025.162 (What does the "m" mean?) Can you try it in Incognito mode and see if perhaps an extension is messing things up?

Did you type something into the text box and press enter?

I tried in Inkognito mode, made sure no extensions are running. Even tested on another computer, same chrome build, same error.

Changed April 28, 2012 06:29PM UTC by dmethvin comment:5

status: newopen

Interesting. If you click away from the box, no error; that is what I was doing. If you hit Enter, there is the error.

This looks like a Chrome bug. If you set Chrome to break on errors, you can see that elem.firstChild is null, yet Chrome enters the loop inside .empty() and errors when trying to run elem.removeChild( null ). http://i.imgur.com/LjOuG.png

Not sure whether/when we'll fix it, but it should be reported to Chrome.

Changed May 03, 2012 10:10AM UTC by sindresorhus comment:6

Looks like it has already been reported back in november: http://code.google.com/p/chromium/issues/detail?id=104397

Changed June 02, 2012 06:28PM UTC by dmethvin comment:7

resolution: → patchwelcome
status: openclosed

Other than the dreaded try-catch, which isn't really a fix, I don't think there is a way for us to fix this. If Chrome says there's a .firstChild it should let us remove that child without complaint.

Changed September 11, 2012 01:58AM UTC by dmethvin comment:8

#12505 is a duplicate of this ticket.

Changed January 16, 2013 01:09PM UTC by mastah comment:9

Problem seem to be corrected with jquery 1.9.x

http://jsfiddle.net/Mastah/PdtKD/

Test that under chrome with jquery 1.8.3 and 1.9.0

Just click append, then focus on input and press enter.

It will properly work under jquery 1.9.0, but will fail under 1.8.3