Bug Tracker

Opened 14 years ago

Closed 13 years ago

#4564 closed bug (invalid)

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]

Change History (2)

comment:1 Changed 14 years ago by dmethvin

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

comment:2 Changed 13 years ago by addyosmani

Keywords: comments added
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.

Note: See TracTickets for help on using tickets.