#11663 closed bug (patchwelcome)
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/
Change History (9)
comment:1 Changed 11 years ago by
Component: | unfiled → event |
---|---|
Owner: | set to Sebmaster |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 11 years ago by
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.
comment:3 follow-up: 4 Changed 11 years ago by
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?
comment:4 Changed 11 years ago by
Status: | pending → new |
---|
Replying to 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.
comment:5 Changed 11 years ago by
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.
comment:6 Changed 11 years ago by
Looks like it has already been reported back in november: http://code.google.com/p/chromium/issues/detail?id=104397
comment:7 Changed 11 years ago by
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.
comment:9 Changed 10 years ago by
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?