Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#1888 closed bug (fixed)

jQuery(string) create not valid DOM when string is html with newlines

Reported by: lucifer4u Owned by:
Priority: major Milestone: 1.2.2
Component: ajax Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:


It is common task to get html from server and to work with it in its own context. I have test.html file with this content:

      Test page
      Some information

So after trying


i found an error. Here is more info about:

Test examples:

			var s1 = '<html><head><title>info</title></head><body><div>info</div></body></html>';
			alert($(s1).find('div')); // [object Object]
			var s2 = '<html>\n<head><title>info</title></head><body><div>info</div></body></html>';
			alert($(s2).find('div')); // [error]


			function jquery_from_html(data) {
				return $("<moo/>").append(data);

Example of usage:

					d = $("div#system", jquery_from_html(s));

Found in jquery source in load function:

						// Create a dummy div to hold the results

Attachments (1)

jquery_test.html (977 bytes) - added by davidserduke 15 years ago.
test case

Download all attachments as: .zip

Change History (3)

comment:1 Changed 15 years ago by joern

Component: coreajax

comment:2 Changed 15 years ago by davidserduke

Resolution: fixed
Status: newclosed

Fixed in [4062]. It was fixed when #1039 and #1733 were fixed.

Changed 15 years ago by davidserduke

Attachment: jquery_test.html added

test case

Note: See TracTickets for help on using tickets.