#1730 closed bug (wontfix)
dynamically created label elements must be closed under IE6
Reported by: | simeon | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
the following code worked under IE6 with JQuery 1.1.2
label = jQuery("<label>").html("foo");
JQuery 1.2.1 only creates the label element if the html closes the tag like
label = jQuery("<label></label>").html("foo");
Both versions work under Firefox 2. This behavior is breaking Jorn Zaefferer's Validation plugin for me...
Attachments (2)
Change History (4)
comment:1 Changed 15 years ago by
Changed 15 years ago by
Attachment: | patch.diff added |
---|
Applied to jquery-1.2.1.js it fixes this bug. Will look into downloading source and applying to core.js
Changed 15 years ago by
Attachment: | patch.2.diff added |
---|
Output of svn diff from trunk directory. Built jquery.js and confirmed that bug is fixed.
comment:2 Changed 15 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Correct, as of jQuery 1.2 you must do: $("<label/>") or $("<label></label>") - we can only accept valid HTML or XHTML. In this case, it's a bug in the form validation plugin - however, looking through the source in SVN, that line doesn't seem to be there any more (it appears as if Joern has fixed it).
Ok, I have a patch but I don't understand all the implications of the code so it may not be optimal...
I tested this with older releases and 1.1.3.1 was the last version that worked. To be clear - the following code produces no output under jquery-1.2.1:
The problem is in the clean() function - as of 1.1.4 and up there's a catch-all for IE that builds the innerHTML of the element being constructed with extra div tags. This breaks the label as the innerHTML property on IE6 ends up having wrapped tags like
By adding a specific check for the label tag and using blank wrapper args (see patch) I once again can get the above code to run successfully... My feelings won't be hurt if somebody else wants to take this bug over and solve it some other way - I'm not at all familiar with JQuery (I'm working on it though!)