Mansuro
Mansuro

Reputation: 4617

extjs problem with internet explorer 8

I have a javascript code, containing an array with trailing comma

 items:[{
    id: 'col-1',
    flex: 1 , //this comma is the source of the problem
   },{
    id: 'col-2',
    flex: 1,
   }
  ]

So here is my problem, when I have this comma, it works on internet explorer 8 with localhost, but when i try to access it from the server, it doesn't work and when I remove it, it works fine. I searched on the internet, and the answer was that IE doesn't support trailing comma, but in this case, why does it work from localhost and not from the server?

I'm using Quirks compatibility mode, and I don't have in the header X-UA-COMPATIBLE, here's the header

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta name="Description" content="Default Style" />
    <meta name="Version" content="2.1.1" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>project name</title>
    <link rel="stylesheet" type="text/css" href="./style/default/main.css" media="all" />
    <style type="text/css" media="all">@import "./style/default/main.css";</style>
    <link rel="shortcut icon" href="./style/default/images/favicon.ico" type="image/ico" />
    <script type="text/javascript" src="http://10.215.63.218/Apsys/js/base.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/js/collapse.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/lib/overlib/overlib.js"></script>
</head>

Upvotes: 0

Views: 3049

Answers (3)

Robby Pond
Robby Pond

Reputation: 73484

You should remove all the trailing commas. Firefox doesn't choke on them but version of IE will.

Upvotes: 2

Fatih Acet
Fatih Acet

Reputation: 29529

Trailing commas are unnecessary and should be avoided also it is a bad coding practice.

Upvotes: 2

Quentin
Quentin

Reputation: 943450

I'd imagine that the trailing comma bug was fixed in IE8, but that when you view it on the server you are doing so in Quirks mode or IE7 Compatibility Mode.

Upvotes: 1

Related Questions