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一段时间了,或者你一直想保持 ...
随机推荐
- linux上使用shell脚本查看内存使用率
如上的内存利用率 = [-/+buffers/cache:used]/[Mem:total ] = 6293404 / 16333656 对于free命令而言,有如下公式: total = used ...
- Android的常用adb命令
第一部分:1. ubuntu下配置环境anroid变量:在终端执行 sudo gedit /etc/profile 打开文本编辑器,在最后追加#setandroid environment2. 运行E ...
- Hibernate与MyBatis
一. Hibernate与MyBatis Hibernate 是当前最流行的O/R mapping框架,它出身于sf.net,现在已经成为Jboss的一部分. Mybatis 是另外一种优秀的O/R ...
- Windows Store App JavaScript 开发:选取文件和文件夹
前面提到过,文件打开选取器由FileOpenPicker类表示,用于选取或打开文件,而文件夹选取器由FolderPicker类表示,用来选取文件夹.在FileOpenPicker类中,pickSing ...
- Window远程连接Linux系统(CentOS7)
新开的云服务器是CentOS系统,基本操作按照腾讯云的介绍 http://www.qcloud.com/wiki/%E4%BB%8E%E6%9C%AC%E5%9C%B0Windows%E6%9C%BA ...
- int unsigned实验
create table t1(a int unsigned,b int unsigned); insert into t1 select 1,2; select 1-2 from t1; Error ...
- CodeForces #362 div2 B. Barnicle
题目链接: B. Barnicle 题意:给出科学计数法 转化成十进制的整数或小数 并输出. 思路:暑假训练赛见过了,当时大腿A掉了,并表示是道水题. 刷CF再次遇见,毫不留情WA了几次.比如: 0. ...
- php开发必备小工具
/*递归删除目录及目录下的文件*/ function del_dir($dir){ $files = new DirectoryIterator($dir); foreach ($files as $ ...
- java时间戳
1.时间戳的定义 时间戳是指文件属性里的创建.修改.访问时间. 数字时间戳技术是数字签名技术一种变种的应用.在电子商务交易文件中,时间是十分重要的信息.在书面合同中,文件签署的日期和签名一样均是十分重 ...
- Codeforces Round #380 (Div. 1, Rated, Based on Technocup 2017 - Elimination Round 2)
http://codeforces.com/contest/737 A: 题目大意: 有n辆车,每辆车有一个价钱ci和油箱容量vi.在x轴上,起点为0,终点为s,中途有k个加油站,坐标分别是pi,到每 ...