Skip to main content

Bug Tracker

Side navigation

#4564 closed bug (invalid)

Opened April 21, 2009 12:28PM UTC

Closed October 09, 2010 01:53AM UTC

jQuery with html comments and whitespace inconsistent

Reported by: chopper2000uk Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: comments Cc:
Blocked by: Blocking:
Description

$("<!-- comment1 --><!-- comment2 --><div/>")

returns [div]

$("<!-- comment1 --><!-- comment2 --> <div/>")

returns [" ", div]

Attachments (0)
Change History (2)

Changed May 14, 2009 02:07AM UTC by dmethvin comment:1

So are you saying the second case shouldn't have the text node?

Changed October 09, 2010 01:53AM UTC by addyosmani comment:2

keywords: → comments
resolution: → invalid
status: newclosed

Looking at the FireBug output for this, I would say that the current output is actually correct (in that it does output a text node for the whitespace). Reference: http://jsfiddle.net/addyosmani/ww47d/

Semantically speaking the first case and the second are not identical.

Here's why this is a good thing: What if someone wanted to actually test for a user including whitespace after a comment in this example?

Simply normalizing the behavior so that the first and second cases are equivalent would make it more difficult for them to do so.

I'm closing this ticket for now as we haven't had any further updates on Dave's original question for a year.

If the original ticket submitter (chopper2000uk) would like to re-submit the ticket with further details of why and what the expected behavior should be we will re-investigate.