Skip to main content

Bug Tracker

Side navigation

#14887 closed bug (notabug)

Opened March 14, 2014 12:30AM UTC

Closed March 14, 2014 03:22AM UTC

Possible bug for parseHTML

Reported by: homawong@gmail.com 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

Attachments (0)
Change History (2)

Changed March 14, 2014 03:04AM UTC by anonymous comment:1

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

Please close if this is expected.

Thanks,

Changed March 14, 2014 03:22AM UTC by dmethvin comment:2

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