understand dojo/domReady!
require(["dojo/dom", "dojo/domReady!"], function(dom){
dom.byId("helloworld").innerHTML = "Hello New World!";
});
The sharped eyed among you will notice that there is a "module" in the requirement array that doesn't have a return variable, called dojo/domReady!. This is actually a loader "plugin" that is used to control the behaviour of the loader. This one ensures that the loader waits until the DOM structure for the page is ready. In an async world, it isn't a bright idea to assume that your DOM structure is there if you want to manipulate it, so if you are going to be doing something with the DOM in your code, make sure you include this plugin. Since we don't use the plugin in the code, it is the standard convention to put it at the end of the array and not provide a return variable for it.
understand dojo/domReady!的更多相关文章
- dojo/domReady! 中感叹号的作用
废话 其实不算个技术问题,但实在是花了我不少时间,不记下来都对不起我这浪费掉的几十分钟. 问题 在dojo官网上看教程,跟着做点练习,看到Dojo DOM Functions那节,有一个练习是改变页面 ...
- dojo 官方翻译 dojo/domReady 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/domReady.html#dojo-domready dom加载完成后,执行. requi ...
- Dojo: Quick Start
1.Dojo学习地址 2.Dojo快速开始 2.1.Dojo引入 2.2.指定Dojo模块的位置 2.3.模块加载require 3.查找Dom节点 3.1.根据id查找dom节点 3.2.根据c ...
- 【原创】(AMD)JavaScript模块化开发(dojo)
AMD原理等在这里就不进行说明了,作者也是菜鸟一枚,只是对自己的一个实例进行说明,如有错误,望指出. 首先,先推荐一篇AMD方面的文章,有兴趣的可以参考:http://efe.baidu.com/bl ...
- Events with Dojo(翻译)
In this tutorial, we will be exploring dojo/on and how Dojo makes it easy to connect to DOM events. ...
- Using dojo/query(翻译)
In this tutorial, we will learn about DOM querying and how the dojo/query module allows you to easil ...
- Dojo特效(翻译)
http://dojotoolkit.org/documentation/tutorials/1.10/effects/index.html In this tutorial, we will exp ...
- DOJO DOM 功能
In this tutorial, you'll learn about how to use Dojo to manipulate the DOM in a simple, cross-browse ...
- 现代DOJO(翻译)
http://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/index.html 你可能已经不用doio一段时间了,或者你一直想保持 ...
随机推荐
- node.js的优缺点
node.js的优缺点 优点: 1. 采用事件驱动,异步编程,为网络服务而设计. 2. node.js非阻塞模式的IO处理给node.js带来在相对较低的资源耗用下的高性能与出众的负载能力. 3. n ...
- Zotero 使用指南
DownLoad Page: https://onedrive.live.com/redir?resid=5084666E7B16AA85!109&authkey=!ABHQp7yfMnLpE ...
- 学习PYTHON之路, DAY 3 - PYTHON 基础 3 (函数)
一 set 集合 (无序且不重复的元素集合) 基本操作: t.add('x') # 添加一项 s.update([10,37,42]) # 在s中添加多项 删除一项: t.discard('H') t ...
- C#中的@符号用法
C#中的@符号其实有很多的用法,我们来看看@有什么神奇之处. 1.限定字符串 用 @ 符号加在字符串前面表示其中的转义字符“不”被处理. 如果我们写一个文件的路径,例如"D:/文本文件&qu ...
- Eclipse 离线安装ADT
由于小猪的Eclipse中ADT版本过低无法打开Android项目了,所以要更新ADT(Android Develop Tools),但是在国内由于谷歌与本国微妙的关系想自动安装总是卡在某个点上. 所 ...
- erlang 查看内存消耗的方法?
找出消耗内存最多的进程 : lists:reverse(lists:keysort(2,[{P, erlang:process_info(P, heap_size)} || P <- erlan ...
- Android中View的事件分发机制
简介 事件也称MotionEvent,事件分发机制就是对MotionEvent事件的分发过程,即当一个MotionEvent发生之后,系统需要把这个事件传递给一个具体的View. 点击事件的分发过程由 ...
- Android中的数据保存
形式 Android的数据保存分为3种形式:file, SharedPreference, Database 文件 主要思想就是通过Context类中提供的openFileInput和openFile ...
- 对于Python中self的看法
首先看一段Java代码 public class Test { public String name; public int age; public String gender; public Str ...
- 微信APP支付服务端开发Java版(一)
一.准备工作 去微信开发者中心下载(扫码支付,里面的大部分代码是可以用的) https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=11 ...