Recommended dojo study notes_dojo
Before referencing dojo.js, it is best to declare the djConfig object so that the set value can be obtained when dojo.js is loaded. Although dojo supports setting after loading after version 0.3, it is strongly recommended that you declare the code of djConfig as the first A piece of script:
A complete djConfig object is defined as follows (the values are all dojo’s default values)
js code
var djConfig = {
bindEncoding: "",
allowQueryConfig: false,
baseScriptUri: "",
parseWidgets: true
searchIds: [],
baseRel ativePath: "",
libraryScriptUri: "",
iePreventClobber: false,
ieClobberMinimal: true,
preventBackButtonFix: true,
debugContainerId is also related to debugging. If not specified, the debugging information will be directly used in the document .write output, which may destroy the overall layout of the page, so you can specify the id of any HTML element that can be used as a container as a debug information output container
allowQueryConfig. This attribute indicates whether dojo allows reading from the parameters of the page url. Get the relevant attributes in djConfig. When the value is true, dojo will give priority to reading other attributes of djConfig from the url parameter, such as: http://server/dojoDemo.htm?djConfig.debugContainerId=divDebug
baseScriptUri, generally No setting is required. Dojo will automatically set this value according to the path you use to reference dojo.js. For example,
, and the automatically obtained value is ../dojo/
ps: If you have multiple projects that need to be referenced at the same time For dojo.js, it is recommended to treat dojo as an independent project and use the absolute path when referencing it.
parseWidgets, this can control whether dojo automatically parses html elements with dojoType into corresponding widgets. If you No Widget is used. It is recommended to set it to false to speed up the loading speed of dojo.
searchIds, which is a string array that defines the IDs of all HTML elements that need to be parsed as widgets. If the ID is not in the HTML element, it will not be used. Parsed, when the array is an empty array, all elements with dojoType will be parsed
There is also a bindEncoding, which is used to set the default binding request encoding method.
dojo.raise throws an exception
dojo.errorToString converts the exception into a string
js code
try {
dojo.raise("Printing failed", new Error("The file does not Exists"));
} catch(e)
{ alert(dojo.errorToString(e));
}
isDebug is a very useful attribute. If set to true, Then all the output of dojo.Debug is valid and should be set to true when developing and false when publishing.
1 Calculate the size of a block in HTML
js code
dojo.style.getOuterWidth / dojo.style.getOuterHeight
dojo.style.getInnerWidth / dojo.style.getInnerHeight
2 Modify CSS
js code
dojo.html.addClass(node, className)
dojo.html.prependClass(node, className)
dojo.html.removeClass(node, className)
dojo.html .replaceClass(node, className, oldClassName)
3 animation
js code
fadeIn, fadeShow, fadeOut, fadeHide,
wipeIn, wipeOut
explode, implode
highlight, unhigh light
Example: wipeOut(elId dojo.lfx. In(elId, 300).play();
} }
function fadeOut(elId){
dojo.lfx.html.fadeOut(elId, 300).play();
} wipe
function fadeIn(elId){
dojo.lfx.html.fadeIn(elId, 300).play();
} function opacity(elId){
dojo.html.setOpac ity(elId , 0.5); });
} . lang module:
dojo.lang.mixin adds methods and properties of one object to another object:
js code
var s1 = {name: "TestObj", test1: function(){alert ("this is test1!");}}
var s2 = {value: 1000, test2: function(){alert("this is test2!");}}
var d = {};
dojo.lang.mixin(d, s1, s2); //After execution, d will have all the attributes and methods of s1 and s2 d.test1();
dojo.lang.extend is the prototype of the specified class Extension methods and attributes:
js code
TestClass = function() {};
dojo.lang.extend(TestClass, {name: "demo", test: function(){alert("Test! ");}});
var o = new TestClass();
dojo. lang.find=dojo.lang.indexOf finds the position of the specified object in the specified array:
js code
var arr = [1,2,3,3,2,1];
dojo.lang .find(arr, 2); //will return 1
dojo.lang.extrasdojo.lang.setTimeout executes the specified method after delaying the specified time:
js code
function onTime(msg){dojo.debug (msg)}
dojo.lang.setTimeout(onTime, 1000, "test"); //Debug information "test" will be output after 1 second
DOM operation
js code
dojo.dom.isNode
dojo.dom.getTagName
dojo.dom.firstElement
dojo.dom.lastElement
dojo.dom.nextElement
dojo.dom.prevElement
dojo.dom.moveChildren (srcNode, destNode , trim)
dojo.dom.copyChildren (srcNode, destNode, trim)
dojo.dom.removeChildren(node)
dojo.dom.replaceChildren(node, newChild)
dojo.dom.removeNode (node) . insertAfter

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

The article discusses effective JavaScript debugging using browser developer tools, focusing on setting breakpoints, using the console, and analyzing performance.

The article explains how to use source maps to debug minified JavaScript by mapping it back to the original code. It discusses enabling source maps, setting breakpoints, and using tools like Chrome DevTools and Webpack.

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

This tutorial will explain how to create pie, ring, and bubble charts using Chart.js. Previously, we have learned four chart types of Chart.js: line chart and bar chart (tutorial 2), as well as radar chart and polar region chart (tutorial 3). Create pie and ring charts Pie charts and ring charts are ideal for showing the proportions of a whole that is divided into different parts. For example, a pie chart can be used to show the percentage of male lions, female lions and young lions in a safari, or the percentage of votes that different candidates receive in the election. Pie charts are only suitable for comparing single parameters or datasets. It should be noted that the pie chart cannot draw entities with zero value because the angle of the fan in the pie chart depends on the numerical size of the data point. This means any entity with zero proportion

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
