Skip to main content

Bug Tracker

Side navigation

#8395 closed bug (invalid)

Opened February 26, 2011 08:37PM UTC

Closed February 28, 2011 11:20AM UTC

Last modified March 01, 2011 03:11AM UTC

.append does not insert strings with html markup, does not always insert strings - jQuery 1.5

Reported by: donovan@donovanwalker.com Owned by: donovan@donovanwalker.com
Priority: low Milestone: 1.next
Component: manipulation Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

Running FF 3.6.13

With an empty body tag, or a body tag with a single unattributed, unstyled div..

$('body').append('somestring'); works

$('div').append('somestring'); works

$('body').append('<div>asdf</div>'); fails with

Node cannot be inserted at the specified point in the hierarchy - code: 3

$('div').append('<div>asdf</div>');

Node cannot be inserted at the specified point in the hierarchy - code: 3

Additionally:

  • In tests where the insertion string includes HTML markup that is preceded by non HTML insertion has been found to work -on occasion-
  • There are other instances of insertion failure for non-HTML strings in situations that may involve nested matching elements
Attachments (0)
Change History (9)

Changed February 26, 2011 08:38PM UTC by anonymous comment:1

Sorry about not using jsFiddle...

Changed February 27, 2011 01:54AM UTC by dmethvin comment:2

owner: → donovan@donovanwalker.com
status: newpending

No problem, just log in and add your jsfiddle case so the ticket won't be closed.

Changed February 27, 2011 02:52AM UTC by donovan@donovanwalker.com comment:3

status: pendingnew

I'm unable to replicate the error with jsFiddle, but it does exist in 'standalone' documents.

Advice?

Changed February 27, 2011 02:59AM UTC by rwaldron comment:4

component: unfiledmanipulation
priority: undecidedlow
status: newpending

I'm having a hard time believing that this is a jQuery bug, considering the high volume of our >4000 unit tests actually do this very operation as part of testing another piece of functionality. If this were the case, the test suite would be failing an unacceptable number of tests (1 fail is considered unacceptable).

Any simple manipulation test should be reproducible in jsFiddle

Changed February 27, 2011 09:36PM UTC by addyosmani comment:5

I share rwaldron's thoughts on this.

That said, an alternative to you posting the code on jsFiddle is uploading us a zip or HTML file containing the local 'standalone' document tests you've been running. This will allow us to evaluate for certain whether the issue is with jQuery or some aspect of your code. Thanks!

Changed February 27, 2011 11:46PM UTC by donovan@donovanwalker.com comment:6

status: pendingnew

Yup. I'm going to do some more work to get an absolute minimum amount of code that reproduces the error and attempt to replicate that in fiddle. I'll submit my results with a link to fiddle, or the code, or a request to close the ticket.

Stay tuned!

Changed February 28, 2011 05:06AM UTC by anonymous comment:7

Ok, it turns out the minimum amount of code to reproduce the error is jQuery 1.5.1 + a really cool templating plugin I've been maintaining for a couple years. (Orange-J)

I don't even need to run the plugin's code.. just including it breaks something. Can you take a peek and tell me what's broke with this version of jQuery?

I've included a fiddle with embedded source code.

http://jsfiddle.net/relativityboy/uGzvK/1/

Close the ticket, but please give me a hand if you can figuring this one out. TIA!

Changed February 28, 2011 11:20AM UTC by jitter comment:8

resolution: → invalid
status: newclosed

Replying to [comment:7 anonymous]:

Ok, it turns out the minimum amount of code to reproduce the error is jQuery 1.5.1 + a really cool templating plugin I've been maintaining for a couple years. (Orange-J) I don't even need to run the plugin's code.. just including it breaks something. Can you take a peek and tell me what's broke with this version of jQuery? I've included a fiddle with embedded source code. http://jsfiddle.net/relativityboy/uGzvK/1/ Close the ticket, but please give me a hand if you can figuring this one out. TIA!

Without checking too closely the problem seems to be that your plugin defines it's own jQuery.clone method and thus overwrites the original one which exists since jQuery 1.5

Changed March 01, 2011 03:11AM UTC by donovan@donovanwalker.com comment:9

Ha! You're right! jQuery co-opted my clone method name.

For a long time I've been thinking about scoping orange-j within a child attribute. Are there any single letter attributes that are safe?

$.o.<methodname> or $.j. or $.oj._ some such? I'd really hate to have to retro actively fix something like $('x').snippet()..

Better yet, any thoughts on getting the templating part incorporated into UI?