2

I use Google closure library and compiler in my project.

I get strange error on next string:

if (!properties.name) {
    throw {message: 'Widget name expected'};
}
properties.name = properties.name.toLowerCase();
goog.require('DOMless.' + properties.parent);

goog.require('DOMless.' + properties.parent);
// ERROR - Syntax error in JS String literal

What is wrong?

4

1 回答 1

3

goog.require is a specific instruction for the Closure compiler, which will be removed from the script.

As it's not interpreted by the JavaScript engine, I think you simply can't use something's else than a string as argument.

于 2013-03-29T20:19:06.733 回答