#6162 closed bug (invalid)
CLASS function with XHTML DocumentFragment: elem.getAttribute is not a function
Reported by: | janmoesen | Owned by: | janmoesen |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.2 |
Component: | attributes | Version: | 1.4.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Since jQuery 1.4, my XHTML web-app (too vague, I know) throws a fatal error in the |CLASS| function. Apparently, the |elem| that is being used is not an element but a |DocumentFragment|.
When I switch the |Content-Type| to |text/html|, the problem is gone.
I have hackily patched the |CLASS| function in jquery-1.4.2.js on line 3269 to check for a |firstChild| as follows:
var className = elem.className; if (!className) {
if (elem.getAttribute) {
className = elem.getAttribute('class');
} else if (elem.firstChild && elem.firstChild.getAttribute) {
className = elem.firstChild.getAttribute('class');
}
} return (" " + className + " ").indexOf( match ) > -1;
The patches from ticket #5706 dit not help. Does this bug also fall under "We're going to tackle this, and a number of other XML/XHTML/XUL/SVG related issues post-1.4. Thanks for the patch!"
Change History (9)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
I've got problems with XHTML too. Look http://dev.jquery.com/ticket/5847
comment:3 Changed 12 years ago by
Keywords: | needsreview added |
---|---|
Owner: | set to janmoesen |
Priority: | → undecided |
Status: | new → pending |
Please provide a reduced jsFiddle test case, thanks!
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.
comment:6 Changed 12 years ago by
I did a try with jquery-git.js and the problem remain.
I saved the test case as http://jsfiddle.net/Qekyj/ but you cannot verify it using jsFiddle because the problem is in some way related to the mime type and I can't set it.
There is a little test case in the ticket #7642
this one works: http://elrond.aspix.it/jquery/test.html
this one no: http://elrond.aspix.it/jquery/test.xhtml
comment:7 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
comment:8 Changed 12 years ago by
This bug looks like it was marked as "invalid" due to inactivity--probably due to the end-of-year holiday season.
This is still a problem. When a web server's response MIME type is "application/xhtml+xml", jQuery has errors as indicated in this bug as well as its duplicates.
This applies to v1.4.4.
Comment 6 by [email protected]… seems to have the best test case.
Is there anything I can do to move this forward? We have had to revert our application/xhtml+xml to text/html because of this, and are eager to go back.