Skip to main content

Bug Tracker

Side navigation

#8114 closed bug (invalid)

Opened February 01, 2011 06:14AM UTC

Closed February 01, 2011 06:45AM UTC

Last modified February 01, 2011 03:43PM UTC

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

Reported by: Owned by:
Priority: low Milestone:
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></link></channel>').find('link').text();

I've tested it in firefox and chrome.

Attachments (0)
Change History (4)

Changed February 01, 2011 06:45AM UTC by danheberden comment:1

component: unfiledcore
keywords: → needsdocs
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></link></channel>" ),
    $xml = $( xmlDoc );

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

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

Changed February 01, 2011 11:38AM UTC by jitter comment:2

priority: undecidedlow

Changed February 01, 2011 03:43PM UTC by danheberden comment:3

keywords: needsdocs

Changed February 01, 2011 03:43PM UTC by danheberden comment:4