Skip to main content

Bug Tracker

Side navigation

#10460 closed bug (invalid)

Opened October 09, 2011 02:25PM UTC

Closed March 10, 2012 04:14AM UTC

Defective html when using html(string) on anchor tag in FireFox 3.6.23

Reported by: danelkhen Owned by: danelkhen
Priority: blocker Milestone: 1.next
Component: manipulation Version: 1.7b1
Keywords: Cc:
Blocked by: Blocking:
Description

reproduction js code:

var a = $("<a/>");

a.html("<div>asdasd</div>");

var s = a.html();

Result in FireFox 3.6.23

<div><a xmlns="http://www.w3.org/1999/xhtml">asdsad</a></div>

Result in any other browser:

<div>asdasd</div>

Attachments (0)
Change History (7)

Changed October 09, 2011 02:27PM UTC by danelkhen comment:1

Sorry, here's jsfiddle link:

http://jsfiddle.net/6Ugnc/

Changed October 09, 2011 04:59PM UTC by rwaldron comment:2

component: unfiledmanipulation
milestone: None1.next
priority: undecidedblocker
status: newopen
version: 1.6.41.7b1

Changed October 09, 2011 11:28PM UTC by dmethvin comment:3

owner: → danelkhen
status: openpending

By default, an a element is inline, and a div element is block. So the test case results in an invalid document. I don't have FF 3.6 handy here but does this test case work properly?

http://jsfiddle.net/dmethvin/6Ugnc/1/

Changed October 09, 2011 11:48PM UTC by rwaldron comment:4

Changed October 10, 2011 06:57AM UTC by danelkhen comment:5

status: pendingnew

Yes, in FireFox 3.6, jQuery inserts a weird "A" tag (with xmlns attribute) inside the div.

FireFox 3.6 is available here:

http://www.mozilla.org/en-US/firefox/all-older.html

Changed October 19, 2011 06:16PM UTC by timmywil comment:6

status: newopen

Changed March 10, 2012 04:14AM UTC by dmethvin comment:7

resolution: → invalid
status: openclosed

That is not valid markup in XHTML or HTML4. A link is an inline element and a div is a block element. HTML5 allows it. jQuery supports whatever the browser supports, it isn't something we can easily shim.

http://html5doctor.com/block-level-links-in-html-5/