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