Side navigation
#9615 closed bug (invalid)
Opened June 18, 2011 11:32PM UTC
Closed June 19, 2011 12:45AM UTC
replaceWidth does not work with document.createElement
Reported by: | JorisDebonnet | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I noticed that the documentation page on replaceWidth had an example that didn't work as expected. I emailed the webmaster suggesting that it might be a bug, and he wasn't sure so he removed the example and suggested I'd check up on it.
It did:
$("p").replaceWith(document.createElement("div"));
Note that this jsFiddle uses jQuery 1.3.2: that's where it still works as expected. As soon as you use any version higher than that, it no longer works. Rather than replacing every individual element, it replaces all of them by a single element. This problem only occurs if you use the document.createElement function.
( Which is of course not the easiest way, it makes more sense just putting "<div/>" there, but I suppose the other way should still work. )
Attachments (0)
Change History (1)
Changed June 19, 2011 12:45AM UTC by comment:1
component: | unfiled → manipulation |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
version: | git → 1.6.1 |
This is a feature so that existing elements can be moved rather than duplicated. As you noticed, the intended effect can be done with "<div>" so that elements are created internally.