Bug Tracker

Modify

Ticket #8114 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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

comment:1 Changed 2 years ago by danheberden

  • Keywords needsdocs added
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to core

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.

comment:2 Changed 2 years ago by jitter

  • Priority changed from undecided to low

comment:3 Changed 2 years ago by danheberden

  • Keywords needsdocs removed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.