Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5424 closed bug (invalid)

append(string) not working in IE8

Reported by: JeffMatthews Owned by:
Priority: critical Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

On initial page load, there is a function call to laod information into a span:

addStateToNavigation("AL","Alabama");

function addStateToNavigation(id,name,chamberName1,unicameral) {

<other code precedes this snippet>:

divString=divString+'<div><img class="checkBox" src="VSCheckBoxEmpty.jpeg"/><span class="Senate">Senate</span></div>';

} divString=divString+'</div>'; $("#allStates").append(divString);

} end of function

The <span> in html body is: <span id="allStates"></span>

The span appends fine in FireFox and Chrome. It does not append in IE8.

I marked this as "critical," because if it really is a bug, it makes a critical difference in terms of how to priogram for browser incompatibility. Potentially, complete re-writes would be necessary.

For full page info and source, see: http://sovereignstates.net/StateLegislators/VSLegislators.htm

Change History (5)

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

Block elements (divs) should not be put inside an inline element (span). I don't know if IE allows it but you shouldn't be doing it, especially since the self-closing tags imply the cleanliness of XHTML. http://www.w3.org/TR/html401/struct/global.html#h-7.5.3

It's hard to tell from the code snippet, but it appears that there is an extra closing div tag.

The full page is too big for a test case. Please reduce it to the minimum amount of code and html required to show the problem, and make sure the markup is well formed. You might want to run it by some other eyes on the forums first.

comment:2 Changed 10 years ago by JeffMatthews

No missing <div>. I didn't give you all the code.

However, I see your point (perhaps FF is more forgiving). I changed to spans, but there is another issue that I think I am finding that is actually crashing IE.

Error message:

Expected identifier, string or number Line 441

Line in question is the one that sets class in this block:

$(this).prev().attr( {

src:"VSCheckBoxSelected.jpeg", class:"checkBox"

});

It works in FF and Chrome, not IE.

I tried ending it with a comma and a semi-colon. Neither fixes it.

I am going to re-open ticket, although I know this to be a different subject matter (I want to be sure you get this). If needed, and we confirm a bug, I will be happy to open a ticket with this attr() issue as the subject matter.

Thanks. BTW: Do you know a source that lists which elements are block elements and which are in-line?

comment:3 Changed 10 years ago by JeffMatthews

Resolution: invalid
Status: closedreopened

comment:4 Changed 10 years ago by dmethvin

Resolution: invalid
Status: reopenedclosed

The name "class" is a reserved word, so you can't use it as a bare word in an object definition. Either quote it or use className.

The W3.org site has a complete reference for all the different doctypes. There is a validator on the site so you can check your documents for correctness.

Definitely ask questions like this on the forums before opening (or reopening) a bug ticket. There are a lot more people who can help you there. If the general consensus is that you have really found a bug, then you can open a ticket here *with* a complete test case.

comment:5 Changed 10 years ago by JeffMatthews

I just figured it out. Thanks so much for being there for us!

Note: See TracTickets for help on using tickets.