Side navigation
#5999 closed bug (wontfix)
Opened February 01, 2010 10:23AM UTC
Closed February 01, 2010 04:40PM UTC
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: | ||
Blocked by: | Blocking: |
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 (1)
Change History (2)
Changed February 01, 2010 10:28AM UTC by comment:1
Changed February 01, 2010 04:40PM UTC by comment:2
resolution: | → wontfix |
---|---|
status: | new → closed |
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.
Same test case uploaded to:
http://www.careers.manchester.ac.uk/dynamic/sandbox/jQuery/testcase/testcase.html