문제

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