Dojo.js已经过时了吗?

时间:2014-01-16 07:55:30

标签: javascript dojo

如果我在Dojo页面上的教程中尝试演示应用程序,我会在控制台中收到数十行语法错误。这是正常的吗? 我只粘贴了一小部分错误(实际上有243行有错误)

09:44:58.523 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead touch.js:15
09:44:58.523 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/touch.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.525 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead main.js:3
09:44:58.538 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead string.js:10
09:44:58.538 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/string.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.539 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead window.js:14
09:44:58.544 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead cache.js:9
09:44:58.544 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/cache.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.556 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead a11y.js:6
09:44:58.564 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead focus.js:9
09:44:58.567 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead Destroyable.js:3
09:44:58.567 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dijit//Destroyable.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.569 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead Stateful.js:11
09:44:58.569 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/Stateful.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.577 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead hccss.js:10
09:44:58.577 Error: http://ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/hccss.js is being assigned a //# sourceMappingURL, but already has one
09:44:58.583 SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead _AttachMixin.j

测试的链接是: http://dojotoolkit.org/documentation/tutorials/1.9/themes_buttons_textboxes/demo/Button.php 浏览器是Firefox

所以它应该是非常基本的东西,对吧? 如果您有关于此框架的更多信息,我感兴趣。它可靠吗?我应该开始使用它,还是应该去其他地方看看?

谢谢

2 个答案:

答案 0 :(得分:4)

您的问题并不清楚您使用的是哪种浏览器?了解这一点会很有帮助,以便其他用户可以复制您收到的错误。

首先,在回答您的问题时:“Dojo.js是否过时”? -

Dojo正在积极开发中,该团队目前正在开发v1.10版本。这个项目非常活跃。有关网络当前使用情况的信息,请参阅:Built With。另请参阅问题的回答"Is there a list of commercial support companies for dojo?"。该框架非常可靠和强大。

错误在我的控制台中显示为警告(使用Firefox),并且与控制台如何将源代码映射回原始的未构建代码有关。大多数Javascript框架/工具包(例如Dojo,AngularJs,JQuery等)都使用构建的代码。构建代码是为了减小其大小并消除不必要的混乱(例如注释)。

构建的代码不易读取,因此如果控制台可以链接回原始代码,则非常有用。有关如何实现此链接的信息,请参阅:"Introduction to JavaScript Source Maps - HTML5Rocks"

我不想太过复杂化答案;基本上,该演示使用了Google的内置版本代码,该代码具有旧的源映射格式。上面的HTML5Rocks链接解释了如何更改链接这些地图的方法;错误/警告是使用这种旧格式的结果。

演示按钮在Firefox和Chrome中按预期工作,但我确实得到了与您相同的警告。它们不是真正的错误,只与控制台的功能有关,而与实际页面代码无关。希望有道理吗?

答案 1 :(得分:2)

不。 Dojo很好并且有效(也是1.8,也是1.9。版本) Dojo的流行也在快速增长。

这是我的jsFiddle示例,适用于最新的Dojo http://jsfiddle.net/ondrek/kQhaz/

<强> HTML:

<div data-dojo-type="dijit/layout/BorderContainer">

    <div data-dojo-type="dijit/layout/ContentPane" 
    data-dojo-props="splitter:true, region:'leading'">
            Hello, I'm on left pane!
    </div>

    <div data-dojo-type="dijit/layout/ContentPane" 
    data-dojo-props="splitter:true, region:'center'">
            Hello, I'm center pane!
    </div>

</div>

<强>使用Javascript:

require([
    "dojo/parser",
    "dojo/domReady!",
    "dijit/layout/BorderContainer",
    "dijit/layout/ContentPane"
], function(parser){

    parser.parse();

});

<强> CSS:

html, body, .dijitBorderContainer {
    height: 100%;
}

如果您想要按钮的原始样本,只需添加require和标记。
它会奏效。

我的表格/选择演示:
http://jsfiddle.net/ondrek/MMKdL/

我的对话演示:
http://jsfiddle.net/ondrek/3L4Gf/

相关问题