maybe you have problem with firefox XHTML handling. Basically, when XHTML is case sensitive and all tags are lowercase, so when firefox receive document he execute method that converts all tags to lowercase which can cause errors.
I’m not sure that this issue is also in your code, but this can help.