Bug Tracker

Modify

Ticket #4564 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

Description

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

$("<!-- comment1 --><!-- comment2 --> <div/>") returns [" ", div]

Change History

comment:1 Changed 4 years ago by dmethvin

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

comment:2 Changed 3 years ago by addyosmani

  • Keywords comments added
  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.