Вопрос

Does anyone know why Aptana 3 recognise some codes in jquery-ui's docs as errors? For instance,

{
        "title":
            "Accordion Widget",
        "excerpt":
            "Convert a pair of headers and content panels into an accordion.",
        "termSlugs": {
            "category": [
                "widgets"
            ]
        }
    }

Syntax Error: Unexpected Token ":"

enter image description here

Это было полезно?

Решение 2

It looks like your development environment is parsing the object literal as a statement block (which may be the right thing to do, as curly braces are not always considered as object literals by the Javascript parser itself).

If it does so, then the colon characters after the string literals are indeed syntax errors.

Другие советы

Those script blocks appear to contain JSON rather than JavaScript but they don't have a type attribute to say so (JavaScript is the default data type for a script element). As a result they are parsed as JavaScript and throw an error.

(The { is treated as the opening of a block instead of an object literal, "title" is then a string literal instead of a property name, and : is an error)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top