Skip to main content

Bug Tracker

Side navigation

#14005 closed bug (notabug)

Opened June 10, 2013 04:02PM UTC

Closed June 10, 2013 08:21PM UTC

Last modified June 11, 2013 01:23PM UTC

$.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) )

Attachments (0)
Change History (2)

Changed June 10, 2013 08:21PM UTC by timmywil comment:1

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/

Changed June 11, 2013 01:23PM UTC by anonymous comment:2

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)