Bug Tracker

Modify

Ticket #5999 (closed bug: wontfix)

Opened 3 years ago

Last modified 3 years ago

Firefox wraps an additional <a> tag around script-generated content

Reported by: Pete Morris Owned by:
Priority: minor Milestone: 1.4.2
Component: core Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

When running the attached test case script against jQuery 1.4 and 1.4.1, HTML block elements within an <a> tag that have their content changed via html() have that new content wrapped within an additional <a> tag. This behaviour did not occur within 1.3.2, and only occurs within Firefox. IE and Chrome do not exhibit the same behaviour. Inline elements such as <span> are not wrapped in this way. I realise it is probably considered 'bad' practice to wrap block elements within an inline <a> in terms of HTML, however the fact that it doesn't occur across browsers and was not present in 1.3.2 implies it is nonetheless unintentional. I have attached a test-case HTML file which when run on Firefox 3.5 produces two different result sets; IE and Chrome produce identical result sets.

Attachments

testcase.zip Download (23.7 KB) - added by Pete Morris 3 years ago.
ZIP file containing test case HTML file and the associated jQuery 1.4.1 needed to run it

Change History

Changed 3 years ago by Pete Morris

ZIP file containing test case HTML file and the associated jQuery 1.4.1 needed to run it

comment:2 Changed 3 years ago by john

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

All we're doing in this case is using the standard .innerHTML provided by the browser.

For example, I adapted your test case to only use native browser methods and the bug is still happening:  http://ejohn.org/files/jquery/ticket/5999/

Considering that the element is injected automatically I'm not sure that there's a way that we can reasonably work around it. I think we have to simply remove either: 1) Keep using your invalid markup and doing .empty().append(yourHTML) or 2) Use valid markup and don't encounter any weird cross-browser issues.

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.