Bug Tracker

Modify

Ticket #6467 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

ReplaceAll does not recognize self-closing tags

Reported by: stohn Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

When replaceAll targets an element that closes itself, e.g. <div />, it overlooks the desired element and selects all Html through the next appropriate closing tag.

Attachments

jquery-replaceall-testcase.html Download (1.6 KB) - added by stohn 4 years ago.
Demonstration of bug.

Change History

Changed 4 years ago by stohn

Demonstration of bug.

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

That's not valid markup in XHTML:  http://www.w3.org/TR/xhtml1/#C_3

It's not valid markup in HTML either, since HTML inherently knows whether a tag is self-closing or not and a div is not self-closing.

For brevity, jQuery allows you to specify an empty div in a string as "<div />" but that is because it parses this special case itself. In the case of a div in the document itself, jQuery is at the mercy of the browser's own parser.

In both Firefox/Firebug and IE8/DeveloperTools(F12), if you use the HTML inspector you can see that the browser's parser has ignored the invalid self-closing tag.

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.