Side navigation
#14673 closed bug (notabug)
Opened January 06, 2014 09:56PM UTC
Closed January 07, 2014 02:38PM UTC
Last modified January 07, 2014 02:41PM UTC
The after() method removes element instead of inserting it
Reported by: | reda | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Here is how to reproduce:
//element is a jQuery element (present in the DOM). $('<div></div>').after(element); //element is no more in the DOM
The bug is found starting from v1.9.1 until the latest (2.0.3)
jQuery 1.8.3 is OK.
Attachments (0)
Change History (9)
Changed January 06, 2014 10:03PM UTC by comment:1
owner: | → reda |
---|---|
status: | new → pending |
Changed January 06, 2014 10:08PM UTC by comment:2
Here it is:
Changed January 06, 2014 10:21PM UTC by comment:3
What was your expected outcome? The <div /> is disconnected from the document and you're adding #x to the set after that. Notice that in 1.8.3 the <div> doesn't actually go anywhere after this executed.
This is definitely a behavior change that occurred at 1.9 but I'm trying to understand why the code would need this behavior and what it does.
Changed January 06, 2014 10:34PM UTC by comment:4
I spotted this behavior change because a widget stopped working when upgrading jquery version.
The widget I am using is from a library (an old version) that does nothing important with the after() method and I can easily stop using the after() method.
It is up to you now to investigate further to see if this behavior change was done deliberately or not.
Thanks for your active support.
Changed January 06, 2014 10:37PM UTC by comment:5
What is the name of the widget? Can you point to the code in question?
The behavior change was deliberate but again I'd like to know more about what the caller was expecting. The code snippet as shown was a no-op in 1.8.3 and I suspect it was actually trying to do something.
Changed January 06, 2014 10:53PM UTC by comment:6
The library is:
https://github.com/emposha/FCBKcomplete/blob/master/jquery.fcbkcomplete.js
The version I am using is 2.8.5 (run a git log on the repo if you like to check it)
The current version doesn't contain the culprit call to the after() method:
var json_cache = $('<div></div>').after(element); var json_cache_object = { 'set': function (id, val) { json_cache.data(id, val); }, 'get': function(id) { return json_cache.data(id); } }
Thanks
Changed January 06, 2014 10:54PM UTC by comment:7
owner: | reda |
---|---|
status: | pending → new |
Thanks for the info!
Changed January 07, 2014 02:38PM UTC by comment:8
resolution: | → notabug |
---|---|
status: | new → closed |
The change was committed here, with no description of why. I am going to assume they were just misusing the API, realized a problem, and that's why they changed it.
https://github.com/emposha/FCBKcomplete/commit/95bdc472f073f7c6ab0cd87741d5934c5aab08c3
Changed January 07, 2014 02:41PM UTC by comment:9
@dmethvin Well done. Thanks!
Can you provide an example using jsfiddle.net?