Ticket #4582 (closed enhancement: duplicate)
Cross-browser jQuery(html) behaviour
| Reported by: | borg42 | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | core | Version: | 1.3.2 |
| Keywords: | html area map | Cc: | |
| Blocking: | Blocked by: |
Description
The following should do the same and should work for all tags* in major browsers:
$('<area/>').attr('class', 'myArea');
$('<area class="myArea");
As of v1.3.2, the above commands don't always work in a cross-browser way. (Firefox is pickier than IE here.)
*: it'd be also great if it'd support tags that can appear inside the html body.
Idea: for performance reasons, what about the following implementation: always running the usual div-.innerHTML, detecting failure (.length=0 / tag name /..), and if so, split the string and create the tag with createElement, then apply the attributes? This would only slow down specific tags, and only for browsers that can't create the elements with div-.innerHTML. Furthermore, it wouldn't slow down previously supported tag creations, only new ones.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This is related to #4559 and #4484.