Opened 11 years ago
Closed 11 years ago
#10460 closed bug (invalid)
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>
Change History (7)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Milestone: | None → 1.next |
Priority: | undecided → blocker |
Status: | new → open |
Version: | 1.6.4 → 1.7b1 |
comment:3 Changed 11 years ago by
Owner: | set to danelkhen |
---|---|
Status: | open → 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?
comment:4 Changed 11 years ago by
Still comes out screwy http://gyazo.com/3646171f16f4f881a95b4b5e425977c1.png
comment:5 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Status: | new → open |
---|
comment:7 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | open → closed |
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.
Sorry, here's jsfiddle link: http://jsfiddle.net/6Ugnc/