【问题标题】:Is Dojo.js obsolete?Dojo.js 过时了吗?
【发布时间】:2014-01-16 07:55:29
【问题描述】:

如果我从 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 浏览器是火狐

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

谢谢

【问题讨论】:

    标签: javascript dojo


    【解决方案1】:

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

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

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

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

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

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

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

    【讨论】:

    • 感谢您的详尽回答。我使用的浏览器也是火狐。教程链接也对我有用,除了我惊讶地在控制台中多次看到“语法错误”,这是一个由开发框架的团队构建的简单网页。看起来不太对……但我理解你的解释,现在我对沉浸在这个有趣的框架中感觉好多了。再次感谢
    • 我只接受了 ondrek 的回答,因为他的回答也不错,包含很好的代码 sn-ps,而且他给出答案的速度更快。我为你的答案 +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/

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

    【讨论】:

    • 感谢您提供代码 sn-ps,这是我学习新语言/框架/任何东西的最喜欢的方式。你也先回答,所以我接受你的回答
    猜你喜欢
    • 2020-07-21
    • 2010-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 2017-05-21
    相关资源
    最近更新 更多