Bug Tracker

Opened 10 years ago

Closed 10 years ago

#5436 closed bug (invalid)

empty tags typed <tagName /> instead of <tagName></tagName> cause unexpected behavior.

Reported by: saleh.alabbas Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

Unexpected results happened with different commands, but I'm certain

with .wrapInner():

HTML:

<div>Hi X <em /> </div> <div>Some Text </div>

Executing the following Script:

$('div').wrapInner('<p></p>');

Reslults in following HTML:

<div><p>Hi X <em></em></p></div> <div><p><em>Some Text</em></p></div>

Note the added <em></em> inside the 2nd Div.

Again, the bug occurs for using an empty tag that is terminated with

the <tagName /> syntax.

I tried <a /> instead of <em /> and the same problem occurs.

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

Paragraph tags can't use the <tagname /> syntax, even in XHTML documents:

http://www.w3.org/TR/xhtml1/#C_2

"This appendix summarizes design guidelines for authors who wish their XHTML documents to render on existing HTML user agents ... Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />).

It's likely that bare DOM would exhibit the same behavior for that reason, but I couldn't easily check that without a complete test case. If you can narrow down the problem to one that is valid XHTML, reopen the ticket and attach a test case. Also specify which browsers you used for testing.

Note: See TracTickets for help on using tickets.