Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14005 closed bug (notabug)

$.parseHTML and leading spaces on jQuery 2.0.2

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.2
Keywords: Cc:
Blocked by: Blocking:

Description

As shown in this test case: http://jsfiddle.net/PJgWx/1/ $.parseHTML isn't correctly handling leading spaces while the simple "Relaxed HTML parsing" using $(HTML string) works.

Please fix the method $.parseHTML so we can follow the instructions left in the changelog 2.0.1 ( http://blog.jquery.com/2013/05/24/jquery-1-10-0-and-2-0-1-released/ ) and use always $.parseHTML() as $( $.parseHTML(HTML string) )

Change History (2)

comment:1 Changed 10 years ago by Timmy Willison

Resolution: notabug
Status: newclosed

Leading spaces when parsing HTML are treated as text nodes, which is correct because leading spaces are text and they are being explicitly passed to a method that should know how to parse text. Maybe this example would help clarify:

http://jsfiddle.net/timmywil/PJgWx/3/

comment:2 Changed 10 years ago by anonymous

In my opinion it's not correct to have different outputs from similar operations.

At least, in the documentation, should be stated that $(HTML_string) gives different results from $.parseHTML(HTML_string)

Note: See TracTickets for help on using tickets.