Modify ↓
Ticket #8114 (closed bug: invalid)
Parsing of <link> tag text is incorrect when a url is specified
| Reported by: | simons.mail@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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() );http://jsfiddle.net/danheberden/H9K3Z/
Next time, please be sure to submit a jsfiddle.net test case so we can easily jump into your problem.