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 comment:1
component: | unfiled → event |
---|---|
owner: | → Sebmaster |
priority: | undecided → low |
status: | new → pending |
Changed April 27, 2012 08:36AM UTC by comment:2
status: | pending → new |
---|
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 comment:3
status: | new → pending |
---|
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 comment:4
status: | pending → new |
---|
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 comment:5
status: | new → open |
---|
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 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 comment:7
resolution: | → patchwelcome |
---|---|
status: | open → closed |
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 January 16, 2013 01:09PM UTC by 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
Which browsers are you seeing the problem in?