2014-01-16 31 views
1

如果我從Dojo頁面上的教程嘗試演示應用程序,我會在控制檯中收到數十行語法錯誤。這是正常的嗎? 我粘貼波紋管錯誤的只是一小部分(實際上有243行有錯誤)Dojo.js是否過時?

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 瀏覽器是火狐

所以它應該是相當基本的,對吧? 如果您有關於此框架的更多信息,我很感興趣。它可靠嗎?我應該開始使用它,還是應該到其他地方看看?

謝謝

回答

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/

+0

謝謝你的代碼片段,這是我最喜歡學習新語言/框架/任何東西的方式。你也回答了第一,所以我接受你的回答 – user1137313

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"

我不想讓答案太複雜;基本上,演示使用的是谷歌代碼的內置版本,它具有舊的源映射格式。上面的HTML5Rocks鏈接解釋了鏈接這些地圖的方法是如何改變的;錯誤/警告是使用這種舊格式的結果。

演示按鈕在Firefox和Chrome中按照我的預期工作,但我的警告與您一樣。它們並不是真正的錯誤,只與控制檯的功能有關,而與實際的頁面代碼無關。希望這是有道理的?

+1

謝謝你詳細的答案。我使用的瀏覽器也是Firefox。教程鏈接也適用於我,除了在控制檯中很多次看到「語法錯誤」,由開發框架的同一團隊構建的簡單網頁,我感到驚訝。這看起來不正確......但我理解你的解釋,現在我對這個有趣的框架感到更好。再次感謝 – user1137313

+1

我只接受了ondrek的回答,因爲他的回答也很好,包含了很好的代碼片段,他的答案更快。我爲你的答案+1了,因爲它非常有用 – user1137313