Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14887 closed bug (notabug)

Possible bug for parseHTML

Reported by: homawong@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.0-rc1
Keywords: Cc:
Blocked by: Blocking:

Description

When using parseHTML to parse a string with a single space, it returns an array with one HTMLDocument. Is that the right behavior? Should it be an array with no item?

http://jsbin.com/vurehemo/1/edit

Change History (2)

comment:1 Changed 6 years ago by anonymous

Understand it is handled as a TextNode and can be mitigated using Trim() before calling parseHTML.

Please close if this is expected.

Thanks,

comment:2 Changed 6 years ago by dmethvin

Resolution: notabug
Status: newclosed

It's a strange case but it's expected. We intentionally don't try to trim the string because we want to create any leading/trailing text nodes that may be created. Docs issue created at https://github.com/jquery/api.jquery.com/issues/462

Note: See TracTickets for help on using tickets.