Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8114 closed bug (invalid)

Parsing of <link> tag text is incorrect when a url is specified

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.next
Component: core Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:


When Parsing RSS the following does not return the URL as expected. It returns an empty string.

var text = $('<channel><title>Hello world</title><link>http://www.google.com</link></channel>').find('link').text();

I've tested it in firefox and chrome.

Change History (4)

comment:1 Changed 12 years ago by danheberden

Component: unfiledcore
Keywords: needsdocs added
Resolution: invalid
Status: newclosed

That converts the string into an actual dom node - link tags, as you're probably already aware, don't ever contain html; they are self terminating tags.

If you are using this in an ajax request, simply use the "xml" dataType option.

If you need to parse your text, use jQuery.parseXML

var xmlDoc = jQuery.parseXML( "<channel><title>Hello world</title><link> http://www.google.com</link></channel>" ),
    $xml = $( xmlDoc );

console.log( $xml.find('link').text() );


Next time, please be sure to submit a jsfiddle.net test case so we can easily jump into your problem.

comment:2 Changed 12 years ago by jitter

Priority: undecidedlow

comment:3 Changed 12 years ago by danheberden

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.