Skip to main content

Bug Tracker

Side navigation

#5436 closed bug (invalid)

Opened October 31, 2009 04:26PM UTC

Closed October 31, 2009 07:07PM UTC

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.

Attachments (0)
Change History (1)

Changed October 31, 2009 07:07PM UTC by dmethvin comment:1

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.