Bug Tracker

Modify

Ticket #10460 (closed bug: invalid)

Opened 20 months ago

Last modified 15 months ago

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

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>

Change History

comment:1 Changed 20 months ago by danelkhen

Sorry, here's jsfiddle link:  http://jsfiddle.net/6Ugnc/

comment:2 Changed 20 months ago by rwaldron

  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Version changed from 1.6.4 to 1.7b1
  • Component changed from unfiled to manipulation
  • Milestone changed from None to 1.next

comment:3 Changed 20 months ago by dmethvin

  • Owner set to danelkhen
  • Status changed from open to pending

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/

comment:4 Changed 20 months ago by rwaldron

comment:5 Changed 20 months ago by danelkhen

  • Status changed from pending to new

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

comment:6 Changed 19 months ago by timmywil

  • Status changed from new to open

comment:7 Changed 15 months ago by dmethvin

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

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/

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.