Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13278 closed bug (notabug)

Convert variable data to jQuery object

Reported by: oyapparov@… Owned by: oyapparov@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:

Description

Hello, I've noticed that since upgrading to 1.9.0 handling data as jQuery object stopped working for me. To explain what I mean here, here's a short example of ajax call:

$.ajax({
 type : 'POST',
 url : 'someServerScript',
 data : 'someData',
 success : function(data) { // return data is a piece of HTML
  
   // With previous version, I was able to do this:
   $(data).addClass('someClass');

   // In version 1.9.0 I get error 'unrecognized expression'
 }
});

Please let me know if that description is enough or if I need to collaborate more

Thanks, Oleg

Change History (4)

comment:1 Changed 6 years ago by dmethvin

Owner: set to oyapparov@…
Status: newpending

Did the jQuery Migrate plugin give you any warnings?

comment:2 Changed 6 years ago by Oleg Yapparov <oyapparov@…>

Here's a jQuery Migrate notice: JQMIGRATE: $(html) HTML strings must start with '<' character

And here's the example return data logged in Firebug console, HTML is correct:

<form action="post" method="post">
   <input type="text" size="30" /><br />
   <textarea cols="30" rows="5"> </textarea>
</form>

comment:3 Changed 6 years ago by dmethvin

Resolution: notabug
Status: pendingclosed

Well there you go, your string must not start with '<'. Read the upgrade guide or description in the Migrate plugin and it will help.

comment:4 Changed 6 years ago by anonymous

Perfect, thanks, couldn't find it there before. $.parseHTML() function helped

Note: See TracTickets for help on using tickets.