[Pkg-javascript-commits] [dojo] 07/21: Resolve conflicts with html.js
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.9.2
in repository dojo.
commit 98b5433d604e5fe750ba08a4ccbee5284d738cf7
Author: Dylan Schiemann <dylan at dojotoolkit.org>
Date: Mon Sep 30 16:18:05 2013 -0700
Resolve conflicts with html.js
(cherry picked from commit 8362427ebd661b5afd8fea8ca7c894876750e1e7)
---
AdapterRegistry.js | 39 ++++----
Evented.js | 13 +--
NodeList-data.js | 110 ++++++++++++-----------
NodeList-dom.js | 101 +++++++++++++--------
NodeList-fx.js | 92 +++++++++++++------
NodeList-html.js | 21 +++--
NodeList-manipulate.js | 101 ++++++++++++++++-----
NodeList-traverse.js | 86 +++++++++++++-----
Stateful.js | 43 +++++----
_base/Color.js | 55 +++++++-----
dom-attr.js | 53 ++++-------
dom-construct.js | 87 ++++++++++--------
dom-geometry.js | 40 ++++-----
dom-prop.js | 52 +++--------
dom-style.js | 61 ++++++++-----
dom.js | 72 ++++++++-------
fx.js | 69 ++++++++------
hash.js | 4 +-
html.js | 5 +-
on.js | 25 +++---
query.js | 237 +++++++++++++++++++++++++------------------------
string.js | 2 +-
text.js | 3 +
touch.js | 2 +-
24 files changed, 797 insertions(+), 576 deletions(-)
diff --git a/AdapterRegistry.js b/AdapterRegistry.js
index cc70163..73b6461 100644
--- a/AdapterRegistry.js
+++ b/AdapterRegistry.js
@@ -12,24 +12,29 @@ var AdapterRegistry = dojo.AdapterRegistry = function(/*Boolean?*/ returnWrapper
// in this registry should be of the same arity.
// example:
// | // create a new registry
- // | var reg = new dojo.AdapterRegistry();
- // | reg.register("handleString",
- // | dojo.isString,
- // | function(str){
- // | // do something with the string here
- // | }
- // | );
- // | reg.register("handleArr",
- // | dojo.isArray,
- // | function(arr){
- // | // do something with the array here
- // | }
- // | );
+ // | require(["dojo/AdapterRegistry"],
+ // | function(AdapterRegistry){
+ // | var reg = new AdapterRegistry();
+ // | reg.register("handleString",
+ // | function(str){
+ // | return typeof val == "string"
+ // | },
+ // | function(str){
+ // | // do something with the string here
+ // | }
+ // | );
+ // | reg.register("handleArr",
+ // | dojo.isArray,
+ // | function(arr){
+ // | // do something with the array here
+ // | }
+ // | );
// |
- // | // now we can pass reg.match() *either* an array or a string and
- // | // the value we pass will get handled by the right function
- // | reg.match("someValue"); // will call the first function
- // | reg.match(["someValue"]); // will call the second
+ // | // now we can pass reg.match() *either* an array or a string and
+ // | // the value we pass will get handled by the right function
+ // | reg.match("someValue"); // will call the first function
+ // | reg.match(["someValue"]); // will call the second
+ // | });
this.pairs = [];
this.returnWrappers = returnWrappers || false; // Boolean
diff --git a/Evented.js b/Evented.js
index 661b6d2..208a2a2 100644
--- a/Evented.js
+++ b/Evented.js
@@ -9,15 +9,16 @@ define(["./aspect", "./on"], function(aspect, on){
// A class that can be used as a mixin or base class,
// to add on() and emit() methods to a class
// for listening for events and emitting events:
- //
- // | define(["dojo/Evented"], function(Evented){
- // | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...});
- // | widget = new EventedWidget();
- // | widget.on("open", function(event){
+ // example:
+ // | define(["dojo/Evented", "dojo/_base/declare", "dojo/Stateful"
+ // | ], function(Evented, declare, Stateful){
+ // | var EventedStateful = declare([Evented, Stateful], {...});
+ // | var instance = new EventedStateful();
+ // | instance.on("open", function(event){
// | ... do something with event
// | });
// |
- // | widget.emit("open", {name:"some event", ...});
+ // | instance.emit("open", {name:"some event", ...});
}
Evented.prototype = {
on: function(type, listener){
diff --git a/NodeList-data.js b/NodeList-data.js
index c731a35..29e9801 100644
--- a/NodeList-data.js
+++ b/NodeList-data.js
@@ -116,61 +116,67 @@ define([
/*=====
lang.extend(NodeList, {
data: function(key, value){
- // summary:
- // stash or get some arbitrary data on/from these nodes.
- //
- // description:
- // Stash or get some arbitrary data on/from these nodes. This private _data function is
- // exposed publicly on `dojo/NodeList`, eg: as the result of a `dojo.query` call.
- // DIFFERS from jQuery.data in that when used as a getter, the entire list is ALWAYS
- // returned. EVEN WHEN THE LIST IS length == 1.
- //
- // A single-node version of this function is provided as `dojo._nodeData`, which follows
- // the same signature, though expects a String ID or DomNode reference in the first
- // position, before key/value arguments.
- //
- // node: String|DomNode
- // The node to associate data with
- //
- // key: Object|String?
- // If an object, act as a setter and iterate over said object setting data items as defined.
- // If a string, and `value` present, set the data for defined `key` to `value`
- // If a string, and `value` absent, act as a getter, returning the data associated with said `key`
- //
- // value: Anything?
- // The value to set for said `key`, provided `key` is a string (and not an object)
- //
- // example:
- // Set a key `bar` to some data, then retrieve it.
- // | dojo.query(".foo").data("bar", "touched");
- // | var touched = dojo.query(".foo").data("bar");
- // | if(touched[0] == "touched"){ alert('win'); }
- //
- // example:
- // Get all the data items for a given node.
- // | var list = dojo.query(".foo").data();
- // | var first = list[0];
- //
- // example:
- // Set the data to a complex hash. Overwrites existing keys with new value
- // | dojo.query(".foo").data({ bar:"baz", foo:"bar" });
- // Then get some random key:
- // | dojo.query(".foo").data("foo"); // returns [`bar`]
- //
- // returns: Object|Anything|Nothing
- // When used as a setter via `dojo/NodeList`, a NodeList instance is returned
- // for further chaining. When used as a getter via `dojo/NodeList` an ARRAY
- // of items is returned. The items in the array correspond to the elements
- // in the original list. This is true even when the list length is 1, eg:
- // when looking up a node by ID (#foo)
+ // summary:
+ // stash or get some arbitrary data on/from these nodes.
+ //
+ // description:
+ // Stash or get some arbitrary data on/from these nodes. This private _data function is
+ // exposed publicly on `dojo/NodeList`, eg: as the result of a `dojo/query` call.
+ // DIFFERS from jQuery.data in that when used as a getter, the entire list is ALWAYS
+ // returned. EVEN WHEN THE LIST IS length == 1.
+ //
+ // A single-node version of this function is provided as `dojo._nodeData`, which follows
+ // the same signature, though expects a String ID or DomNode reference in the first
+ // position, before key/value arguments.
+ //
+ // node: String|DomNode
+ // The node to associate data with
+ //
+ // key: Object|String?
+ // If an object, act as a setter and iterate over said object setting data items as defined.
+ // If a string, and `value` present, set the data for defined `key` to `value`
+ // If a string, and `value` absent, act as a getter, returning the data associated with said `key`
+ //
+ // value: Anything?
+ // The value to set for said `key`, provided `key` is a string (and not an object)
+ //
+ // example:
+ // Set a key `bar` to some data, then retrieve it.
+ // | require(["dojo/query", "dojo/NodeList-data"], function(query){
+ // | query(".foo").data("bar", "touched");
+ // | var touched = query(".foo").data("bar");
+ // | if(touched[0] == "touched"){ alert('win'); }
+ // | });
+ //
+ // example:
+ // Get all the data items for a given node.
+ // | require(["dojo/query", "dojo/NodeList-data"], function(query){
+ // | var list = query(".foo").data();
+ // | var first = list[0];
+ // | });
+ //
+ // example:
+ // Set the data to a complex hash. Overwrites existing keys with new value
+ // | require(["dojo/query", "dojo/NodeList-data"], function(query){
+ // | query(".foo").data({ bar:"baz", foo:"bar" });
+ // Then get some random key:
+ // | query(".foo").data("foo"); // returns [`bar`]
+ // | });
+ //
+ // returns: Object|Anything|Nothing
+ // When used as a setter via `dojo/NodeList`, a NodeList instance is returned
+ // for further chaining. When used as a getter via `dojo/NodeList` an ARRAY
+ // of items is returned. The items in the array correspond to the elements
+ // in the original list. This is true even when the list length is 1, eg:
+ // when looking up a node by ID (#foo)
},
removeData: function(key){
- // summary:
- // Remove the data associated with these nodes.
- // key: String?
- // If omitted, clean all data for this node.
- // If passed, remove the data item found at `key`
+ // summary:
+ // Remove the data associated with these nodes.
+ // key: String?
+ // If omitted, clean all data for this node.
+ // If passed, remove the data item found at `key`
}
});
=====*/
diff --git a/NodeList-dom.js b/NodeList-dom.js
index 87ee7b7..7527a01 100644
--- a/NodeList-dom.js
+++ b/NodeList-dom.js
@@ -12,7 +12,7 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
var magicGuard = function(a){
// summary:
- // the guard function for dojo.attr() and dojo.style()
+ // the guard function for dojo/dom-attr() and dojo/dom-style()
return a.length == 1 && (typeof a[0] == "string"); // inline'd type check
};
@@ -24,7 +24,7 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
p.removeChild(node);
}
};
- // FIXME: should we move orphan() to dojo.html?
+ // FIXME: should we move orphan() to dojo/_base/html?
var NodeList = query.NodeList,
awc = NodeList._adaptWithCondition,
@@ -48,12 +48,12 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
// description:
// If content is an object, it can have special properties "template" and
// "parse". If "template" is defined, then the template value is run through
- // dojo.string.substitute (if dojo/string.substitute() has been dojo.required elsewhere),
+ // dojo/string.substitute (if dojo/string.substitute() has been required elsewhere),
// or if templateFunc is a function on the content, that function will be used to
// transform the template into a final string to be used for for passing to dojo/dom-construct.toDom().
// If content.parse is true, then it is remembered for later, for when the content
// nodes are inserted into the DOM. At that point, the nodes will be parsed for widgets
- // (if dojo.parser has been dojo.required elsewhere).
+ // (if dojo/parser has been required elsewhere).
//Wanted to just use a DocumentFragment, but for the array/NodeList
//case that meant using cloneNode, but we may not want that.
@@ -150,7 +150,7 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
position: function(){
// summary:
// Returns border-box objects (x/y/w/h) of all elements in a node list
- // as an Array (*not* a NodeList). Acts like `dojo.position`, though
+ // as an Array (*not* a NodeList). Acts like `dojo/dom-geometry-position`, though
// assumes the node passed is each node in this list.
return dojo.map(this, dojo.position); // Array
@@ -162,7 +162,7 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
attr: function(property, value){
// summary:
// gets or sets the DOM attribute for every element in the
- // NodeList. See also `dojo.attr`
+ // NodeList. See also `dojo/dom-attr`
// property: String
// the attribute to get/set
// value: String?
@@ -172,14 +172,20 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
// If a value is passed, the return is this NodeList
// example:
// Make all nodes with a particular class focusable:
- // | dojo.query(".focusable").attr("tabIndex", -1);
+ // | require(["dojo/query", "dojo/NodeList-dom"], function(query){
+ // | query(".focusable").attr("tabIndex", -1);
+ // | });
// example:
// Disable a group of buttons:
- // | dojo.query("button.group").attr("disabled", true);
+ // | require(["dojo/query", "dojo/NodeList-dom"], function(query){
+ // | query("button.group").attr("disabled", true);
+ // | });
// example:
// innerHTML can be assigned or retrieved as well:
// | // get the innerHTML (as an array) for each list item
- // | var ih = dojo.query("li.replaceable").attr("innerHTML");
+ // | require(["dojo/query", "dojo/NodeList-dom"], function(query){
+ // | var ih = query("li.replaceable").attr("innerHTML");
+ // | });
return; // dojo/NodeList|Array
},
=====*/
@@ -305,7 +311,7 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
place: function(/*String||Node*/ queryOrNode, /*String*/ position){
// summary:
// places elements of this node list relative to the first element matched
- // by queryOrNode. Returns the original NodeList. See: `dojo.place`
+ // by queryOrNode. Returns the original NodeList. See: `dojo/dom-construct.place`
// queryOrNode:
// may be a string representing any valid CSS3 selector or a DOM node.
// In the selector case, only the first matching element will be used
@@ -376,10 +382,13 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
// | <p>great comedians may not be funny <span>in person</span></p>
// | </div>
// If we are presented with the following definition for a NodeList:
- // | var l = new NodeList(dojo.byId("foo"), dojo.byId("bar"));
+ // | require(["dojo/dom", "dojo/query", "dojo/NodeList-dom"
+ // | ], function(dom, query){
+ // | var l = new NodeList(dom.byId("foo"), dom.byId("bar"));
// it's possible to find all span elements under paragraphs
// contained by these elements with this sub-query:
- // | var spans = l.query("p span");
+ // | var spans = l.query("p span");
+ // | });
// FIXME: probably slow
if(!queryStr){ return this; }
@@ -405,14 +414,19 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
// If a string, a CSS rule like ".thinger" or "div > span".
// example:
// "regular" JS filter syntax as exposed in dojo.filter:
- // | dojo.query("*").filter(function(item){
- // | // highlight every paragraph
- // | return (item.nodeName == "p");
- // | }).style("backgroundColor", "yellow");
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("*").filter(function(item){
+ // | // highlight every paragraph
+ // | return (item.nodeName == "p");
+ // | }).style("backgroundColor", "yellow");
+ // | });
// example:
- // the same filtering using a CSS selector
- // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
-
+ // the same filtering using a CSS selector
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("*").filter("p").styles("backgroundColor", "yellow");
+ // | });
var a = arguments, items = this, start = 0;
if(typeof filter == "string"){ // inline'd type check
items = query._filterResult(this, a[0]);
@@ -468,35 +482,50 @@ define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-cla
// or an offset in the childNodes property
// example:
// appends content to the end if the position is omitted
- // | dojo.query("h3 > p").addContent("hey there!");
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("h3 > p").addContent("hey there!");
+ // | });
// example:
// add something to the front of each element that has a
// "thinger" property:
- // | dojo.query("[thinger]").addContent("...", "first");
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("[thinger]").addContent("...", "first");
+ // | });
// example:
// adds a header before each element of the list
- // | dojo.query(".note").addContent("<h4>NOTE:</h4>", "before");
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query(".note").addContent("<h4>NOTE:</h4>", "before");
+ // | });
// example:
// add a clone of a DOM node to the end of every element in
// the list, removing it from its existing parent.
- // | dojo.query(".note").addContent(dojo.byId("foo"));
+ // | require(["dojo/dom", "dojo/query", "dojo/NodeList-dom"
+ // | ], function(dom, query){
+ // | query(".note").addContent(dom.byId("foo"));
+ // | });
// example:
// Append nodes from a templatized string.
- // | dojo.require("dojo.string");
- // | dojo.query(".note").addContent({
- // | template: '<b>${id}: </b><span>${name}</span>',
- // | id: "user332",
- // | name: "Mr. Anderson"
- // | });
+ // | require(["dojo/string", "dojo/query", "dojo/NodeList-dom"
+ // | ], function(string, query){
+ // | query(".note").addContent({
+ // | template: '<b>${id}: </b><span>${name}</span>',
+ // | id: "user332",
+ // | name: "Mr. Anderson"
+ // | });
+ // | });
// example:
// Append nodes from a templatized string that also has widgets parsed.
- // | dojo.require("dojo.string");
- // | dojo.require("dojo.parser");
- // | var notes = dojo.query(".note").addContent({
- // | template: '<button dojoType="dijit/form/Button">${text}</button>',
- // | parse: true,
- // | text: "Send"
- // | });
+ // | require(["dojo/string", "dojo/parser", "dojo/query", "dojo/NodeList-dom"
+ // | ], function(string, parser, query){
+ // | var notes = query(".note").addContent({
+ // | template: '<button dojoType="dijit/form/Button">${text}</button>',
+ // | parse: true,
+ // | text: "Send"
+ // | });
+ // | });
content = this._normalize(content, this[0]);
for(var i = 0, node; (node = this[i]); i++){
if(content.length){
diff --git a/NodeList-fx.js b/NodeList-fx.js
index 882aa3d..7c19647 100644
--- a/NodeList-fx.js
+++ b/NodeList-fx.js
@@ -42,11 +42,17 @@ lang.extend(NodeList, {
//
// example:
// Fade in all tables with class "blah":
- // | dojo.query("table.blah").wipeIn().play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query("table.blah").wipeIn().play();
+ // | });
//
// example:
// Utilizing `auto` to get the NodeList back:
- // | dojo.query(".titles").wipeIn({ auto:true }).onclick(someFunction);
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".titles").wipeIn({ auto:true }).onclick(someFunction);
+ // | });
//
return this._anim(coreFx, "wipeIn", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -66,7 +72,10 @@ lang.extend(NodeList, {
//
// example:
// Wipe out all tables with class "blah":
- // | dojo.query("table.blah").wipeOut().play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query("table.blah").wipeOut().play();
+ // | });
return this._anim(coreFx, "wipeOut", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -85,10 +94,13 @@ lang.extend(NodeList, {
//
// example:
// | Move all tables with class "blah" to 300/300:
- // | dojo.query("table.blah").slideTo({
- // | left: 40,
- // | top: 50
- // | }).play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query("table.blah").slideTo({
+ // | left: 40,
+ // | top: 50
+ // | }).play();
+ // | });
return this._anim(coreFx, "slideTo", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -108,7 +120,10 @@ lang.extend(NodeList, {
//
// example:
// Fade in all tables with class "blah":
- // | dojo.query("table.blah").fadeIn().play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query("table.blah").fadeIn().play();
+ // | });
return this._anim(baseFx, "fadeIn", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -127,15 +142,24 @@ lang.extend(NodeList, {
//
// example:
// Fade out all elements with class "zork":
- // | dojo.query(".zork").fadeOut().play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".zork").fadeOut().play();
+ // | });
// example:
// Fade them on a delay and do something at the end:
- // | var fo = dojo.query(".zork").fadeOut();
- // | aspect.after(fo, "onEnd", function(){ /*...*/ }, true);
- // | fo.play();
+ // | require(["dojo/query", "dojo/aspect", "dojo/NodeList-fx"
+ // | ], function(query, aspect){
+ // | var fo = query(".zork").fadeOut();
+ // | aspect.after(fo, "onEnd", function(){ /*...*/ }, true);
+ // | fo.play();
+ // | });
// example:
// Using `auto`:
- // | dojo.query("li").fadeOut({ auto:true }).filter(filterFn).forEach(doit);
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query("li").fadeOut({ auto:true }).filter(filterFn).forEach(doit);
+ // | });
//
return this._anim(baseFx, "fadeOut", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -155,21 +179,27 @@ lang.extend(NodeList, {
// chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
//
// example:
- // | dojo.query(".zork").animateProperty({
- // | duration: 500,
- // | properties: {
- // | color: { start: "black", end: "white" },
- // | left: { end: 300 }
- // | }
- // | }).play();
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".zork").animateProperty({
+ // | duration: 500,
+ // | properties: {
+ // | color: { start: "black", end: "white" },
+ // | left: { end: 300 }
+ // | }
+ // | }).play();
+ // | });
//
// example:
- // | dojo.query(".grue").animateProperty({
- // | auto:true,
- // | properties: {
- // | height:240
- // | }
- // | }).onclick(handler);
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".grue").animateProperty({
+ // | auto:true,
+ // | properties: {
+ // | height:240
+ // | }
+ // | }).onclick(handler);
+ // | });
return this._anim(baseFx, "animateProperty", args); // dojo/_base/fx.Animation|dojo/NodeList
},
@@ -195,11 +225,17 @@ lang.extend(NodeList, {
// how long to delay playing the returned animation
// example:
// Another way to fade out:
- // | dojo.query(".thinger").anim({ opacity: 0 });
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".thinger").anim({ opacity: 0 });
+ // | });
// example:
// animate all elements with the "thigner" class to a width of 500
// pixels over half a second
- // | dojo.query(".thinger").anim({ width: 500 }, 700);
+ // | require(["dojo/query", "dojo/NodeList-fx"
+ // | ], function(query){
+ // | query(".thinger").anim({ width: 500 }, 700);
+ // | });
var canim = coreFx.combine(
this.map(function(item){
return baseFx.animateProperty({
diff --git a/NodeList-html.js b/NodeList-html.js
index bc5cc3d..f3fc613 100644
--- a/NodeList-html.js
+++ b/NodeList-html.js
@@ -6,7 +6,7 @@ define(["./query", "./_base/lang", "./html"], function(query, lang, html){
/*=====
return function(){
// summary:
- // Adds a chainable html method to dojo.query() / NodeList instances for setting/replacing node content
+ // Adds a chainable html method to dojo/query() / NodeList instances for setting/replacing node content
};
=====*/
@@ -30,14 +30,17 @@ lang.extend(NodeList, {
// to further tune the set content behavior.
//
// example:
- // | query(".thingList").html("<li data-dojo-type='dojo/dnd/Moveable'>1</li><li data-dojo-type='dojo/dnd/Moveable'>2</li><li data-dojo-type='dojo/dnd/Moveable'>3</li>",
- // | {
- // | parseContent: true,
- // | onBegin: function(){
- // | this.content = this.content.replace(/([0-9])/g, this.id + ": $1");
- // | this.inherited("onBegin", arguments);
- // | }
- // | }).removeClass("notdone").addClass("done");
+ // | require(["dojo/query", "dojo/NodeList-html"
+ // | ], function(query){
+ // | query(".thingList").html("<li data-dojo-type='dojo/dnd/Moveable'>1</li><li data-dojo-type='dojo/dnd/Moveable'>2</li><li data-dojo-type='dojo/dnd/Moveable'>3</li>",
+ // | {
+ // | parseContent: true,
+ // | onBegin: function(){
+ // | this.content = this.content.replace(/([0-9])/g, this.id + ": $1");
+ // | this.inherited("onBegin", arguments);
+ // | }
+ // | }).removeClass("notdone").addClass("done");
+ // | });
var dhs = new html._ContentSetter(params || {});
this.forEach(function(elm){
diff --git a/NodeList-manipulate.js b/NodeList-manipulate.js
index eb36ccb..df6cdd6 100644
--- a/NodeList-manipulate.js
+++ b/NodeList-manipulate.js
@@ -125,13 +125,19 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"></div>
// | <div id="bar"></div>
// This code inserts `<p>Hello World</p>` into both divs:
- // | dojo.query("div").innerHTML("<p>Hello World</p>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").innerHTML("<p>Hello World</p>");
+ // | });
// example:
// assume a DOM created by this markup:
// | <div id="foo"><p>Hello Mars</p></div>
// | <div id="bar"><p>Hello World</p></div>
// This code returns `<p>Hello Mars</p>`:
- // | var message = dojo.query("div").innerHTML();
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | var message = query("div").innerHTML();
+ // | });
if(arguments.length){
return this.addContent(value, "only"); // dojo/NodeList
}else{
@@ -170,13 +176,19 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"></div>
// | <div id="bar"></div>
// This code inserts "Hello World" into both divs:
- // | dojo.query("div").text("Hello World");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").text("Hello World");
+ // | });
// example:
// assume a DOM created by this markup:
// | <div id="foo"><p>Hello Mars <span>today</span></p></div>
// | <div id="bar"><p>Hello World</p></div>
// This code returns "Hello Mars today":
- // | var message = dojo.query("div").text();
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | var message = query("div").text();
+ // | });
// returns:
// if no value is passed, the result is String, the text value of the first node.
// If a value is passed, the return is this dojo/NodeList
@@ -216,10 +228,13 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <option value="yellow" selected>Yellow</option>
// | </select>
// This code gets and sets the values for the form fields above:
- // | dojo.query('[type="text"]').val(); //gets value foo
- // | dojo.query('[type="text"]').val("bar"); //sets the input's value to "bar"
- // | dojo.query("select").val() //gets array value ["red", "yellow"]
- // | dojo.query("select").val(["blue", "yellow"]) //Sets the blue and yellow options to selected.
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query('[type="text"]').val(); //gets value foo
+ // | query('[type="text"]').val("bar"); //sets the input's value to "bar"
+ // | query("select").val() //gets array value ["red", "yellow"]
+ // | query("select").val(["blue", "yellow"]) //Sets the blue and yellow options to selected.
+ // | });
//Special work for input elements.
if(arguments.length){
@@ -289,7 +304,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"><p>Hello Mars</p></div>
// | <div id="bar"><p>Hello World</p></div>
// Running this code:
- // | dojo.query("div").append("<span>append</span>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").append("<span>append</span>");
+ // | });
// Results in this DOM structure:
// | <div id="foo"><p>Hello Mars</p><span>append</span></div>
// | <div id="bar"><p>Hello World</p><span>append</span></div>
@@ -313,7 +331,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <p>Hello Mars</p>
// | <p>Hello World</p>
// Running this code:
- // | dojo.query("span").appendTo("p");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("span").appendTo("p");
+ // | });
// Results in this DOM structure:
// | <p>Hello Mars<span>append</span></p>
// | <p>Hello World<span>append</span></p>
@@ -334,7 +355,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"><p>Hello Mars</p></div>
// | <div id="bar"><p>Hello World</p></div>
// Running this code:
- // | dojo.query("div").prepend("<span>prepend</span>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").prepend("<span>prepend</span>");
+ // | });
// Results in this DOM structure:
// | <div id="foo"><span>prepend</span><p>Hello Mars</p></div>
// | <div id="bar"><span>prepend</span><p>Hello World</p></div>
@@ -358,7 +382,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <p>Hello Mars</p>
// | <p>Hello World</p>
// Running this code:
- // | dojo.query("span").prependTo("p");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("span").prependTo("p");
+ // | });
// Results in this DOM structure:
// | <p><span>prepend</span>Hello Mars</p>
// | <p><span>prepend</span>Hello World</p>
@@ -380,7 +407,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"><p>Hello Mars</p></div>
// | <div id="bar"><p>Hello World</p></div>
// Running this code:
- // | dojo.query("div").after("<span>after</span>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").after("<span>after</span>");
+ // | });
// Results in this DOM structure:
// | <div id="foo"><p>Hello Mars</p></div><span>after</span>
// | <div id="bar"><p>Hello World</p></div><span>after</span>
@@ -404,7 +434,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <p>Hello Mars</p>
// | <p>Hello World</p>
// Running this code:
- // | dojo.query("span").insertAfter("p");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("span").insertAfter("p");
+ // | });
// Results in this DOM structure:
// | <p>Hello Mars</p><span>after</span>
// | <p>Hello World</p><span>after</span>
@@ -426,7 +459,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div id="foo"><p>Hello Mars</p></div>
// | <div id="bar"><p>Hello World</p></div>
// Running this code:
- // | dojo.query("div").before("<span>before</span>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("div").before("<span>before</span>");
+ // | });
// Results in this DOM structure:
// | <span>before</span><div id="foo"><p>Hello Mars</p></div>
// | <span>before</span><div id="bar"><p>Hello World</p></div>
@@ -450,7 +486,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <p>Hello Mars</p>
// | <p>Hello World</p>
// Running this code:
- // | dojo.query("span").insertBefore("p");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("span").insertBefore("p");
+ // | });
// Results in this DOM structure:
// | <span>before</span><p>Hello Mars</p>
// | <span>before</span><p>Hello World</p>
@@ -489,7 +528,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <b>one</b>
// | <b>two</b>
// Running this code:
- // | dojo.query("b").wrap("<div><span></span></div>");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query("b").wrap("<div><span></span></div>");
+ // | });
// Results in this DOM structure:
// | <div><span><b>one</b></span></div>
// | <div><span><b>two</b></span></div>
@@ -529,7 +571,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").wrapAll('<div class="allRed"></div>');
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query(".red").wrapAll('<div class="allRed"></div>');
+ // | });
// Results in this DOM structure:
// | <div class="container">
// | <div class="allRed">
@@ -574,7 +619,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").wrapInner('<span class="special"></span>');
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query(".red").wrapInner('<span class="special"></span>');
+ // | });
// Results in this DOM structure:
// | <div class="container">
// | <div class="red"><span class="special">Red One</span></div>
@@ -617,7 +665,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").replaceWith('<div class="green">Green</div>');
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query(".red").replaceWith('<div class="green">Green</div>');
+ // | });
// Results in this DOM structure:
// | <div class="container">
// | <div class="green">Green</div>
@@ -658,7 +709,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").replaceAll(".blue");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query(".red").replaceAll(".blue");
+ // | });
// Results in this DOM structure:
// | <div class="container">
// | <div class="spacer">___</div>
@@ -695,7 +749,10 @@ define(["./query", "./_base/lang", "./_base/array", "./dom-construct", "./NodeLi
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").clone().appendTo(".container");
+ // | require(["dojo/query", "dojo/NodeList-manipulate"
+ // | ], function(query){
+ // | query(".red").clone().appendTo(".container");
+ // | });
// Results in this DOM structure:
// | <div class="container">
// | <div class="red">Red One</div>
diff --git a/NodeList-traverse.js b/NodeList-traverse.js
index bf36ae9..8283d72 100644
--- a/NodeList-traverse.js
+++ b/NodeList-traverse.js
@@ -6,7 +6,7 @@ define(["./query", "./_base/lang", "./_base/array"], function(dquery, lang, arra
/*=====
return function(){
// summary:
- // Adds chainable methods to dojo.query() / NodeList instances for traversing the DOM
+ // Adds chainable methods to dojo/query() / NodeList instances for traversing the DOM
};
=====*/
@@ -36,7 +36,7 @@ lang.extend(NodeList, {
var ary = [];
//Using for loop for better speed.
for(var i = 0, node; node = nodes[i]; i++){
- //Should be a faster way to do this. dojo.query has a private
+ //Should be a faster way to do this. dojo/query has a private
//_zip function that may be inspirational, but there are pathways
//in query that force nozip?
if(node.nodeType == 1 && array.indexOf(ary, node) == -1){
@@ -85,7 +85,10 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".container").children();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".container").children();
+ // | });
// returns the four divs that are children of the container div.
// Running this code:
// | dojo.query(".container").children(".red");
@@ -119,7 +122,10 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".red").closest(".container");
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".red").closest(".container");
+ // | });
// returns the div with class "container".
return this._getRelatedUniqueNodes(null, function(node, ary){
do{
@@ -151,10 +157,13 @@ lang.extend(NodeList, {
// | <div class="blue"><span class="text">Blue Two</span></div>
// | </div>
// Running this code:
- // | dojo.query(".text").parent();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".text").parent();
+ // | });
// returns the two divs with class "blue".
// Running this code:
- // | dojo.query(".text").parent(".first");
+ // | query(".text").parent(".first");
// returns the one div with class "blue" and "first".
return this._getRelatedUniqueNodes(query, function(node, ary){
return node.parentNode;
@@ -181,11 +190,14 @@ lang.extend(NodeList, {
// | <div class="blue"><span class="text">Blue Two</span></div>
// | </div>
// Running this code:
- // | dojo.query(".text").parents();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".text").parents();
+ // | });
// returns the two divs with class "blue", the div with class "container",
// | the body element and the html element.
// Running this code:
- // | dojo.query(".text").parents(".container");
+ // | query(".text").parents(".container");
// returns the one div with class "container".
return this._getRelatedUniqueNodes(query, function(node, ary){
var pary = [];
@@ -218,11 +230,14 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".first").siblings();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".first").siblings();
+ // | });
// returns the two divs with class "red" and the other div
// | with class "blue" that does not have "first".
// Running this code:
- // | dojo.query(".first").siblings(".red");
+ // | query(".first").siblings(".red");
// returns the two div with class "red".
return this._getRelatedUniqueNodes(query, function(node, ary){
var pary = [];
@@ -257,7 +272,10 @@ lang.extend(NodeList, {
// | <div class="blue last">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".first").next();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".first").next();
+ // | });
// returns the div with class "red" and has innerHTML of "Red Two".
// Running this code:
// | dojo.query(".last").next(".red");
@@ -292,10 +310,13 @@ lang.extend(NodeList, {
// | <div class="blue next">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".first").nextAll();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".first").nextAll();
+ // | });
// returns the two divs with class of "next".
// Running this code:
- // | dojo.query(".first").nextAll(".red");
+ // | query(".first").nextAll(".red");
// returns the one div with class "red" and innerHTML "Red Two".
return this._getRelatedUniqueNodes(query, function(node, ary){
var pary = [];
@@ -330,10 +351,13 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".first").prev();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".first").prev();
+ // | });
// returns the div with class "red" and has innerHTML of "Red One".
// Running this code:
- // | dojo.query(".first").prev(".blue");
+ // | query(".first").prev(".blue");
// does not return any elements.
return this._getRelatedUniqueNodes(query, function(node, ary){
var prev = node.previousSibling;
@@ -367,10 +391,13 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".second").prevAll();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".second").prevAll();
+ // | });
// returns the two divs with class of "prev".
// Running this code:
- // | dojo.query(".first").prevAll(".red");
+ // | query(".first").prevAll(".red");
// returns the one div with class "red prev" and innerHTML "Red One".
return this._getRelatedUniqueNodes(query, function(node, ary){
var pary = [];
@@ -400,7 +427,10 @@ lang.extend(NodeList, {
// | <div class="blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".second").prevAll().andSelf();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".second").prevAll().andSelf();
+ // | });
// returns the two divs with class of "prev", as well as the div with class "second".
return this.concat(this._parent); // dojo/NodeList
},
@@ -423,7 +453,10 @@ lang.extend(NodeList, {
// | <div class="blue last">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".blue").first();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".blue").first();
+ // | });
// returns the div with class "blue" and "first".
return this._wrap(((this[0] && [this[0]]) || []), this); // dojo/NodeList
},
@@ -445,7 +478,10 @@ lang.extend(NodeList, {
// | <div class="blue last">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".blue").last();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".blue").last();
+ // | });
// returns the last div with class "blue",
return this._wrap((this.length ? [this[this.length - 1]] : []), this); // dojo/NodeList
},
@@ -467,7 +503,10 @@ lang.extend(NodeList, {
// | <div class="interior blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".interior").even();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".interior").even();
+ // | });
// returns the two divs with class "blue"
return this.filter(function(item, i){
return i % 2 != 0;
@@ -491,7 +530,10 @@ lang.extend(NodeList, {
// | <div class="interior blue">Blue Two</div>
// | </div>
// Running this code:
- // | dojo.query(".interior").odd();
+ // | require(["dojo/query", "dojo/NodeList-traverse"
+ // | ], function(query){
+ // | query(".interior").odd();
+ // | });
// returns the two divs with class "red"
return this.filter(function(item, i){
return i % 2 == 0;
diff --git a/Stateful.js b/Stateful.js
index b839a86..62512fd 100644
--- a/Stateful.js
+++ b/Stateful.js
@@ -15,11 +15,13 @@ return declare("dojo.Stateful", null, {
// would have a custom getter of _fooGetter and a custom setter of _fooSetter.
//
// example:
- // | var obj = new dojo.Stateful();
- // | obj.watch("foo", function(){
- // | console.log("foo changed to " + this.get("foo"));
+ // | require(["dojo/Stateful", function(Stateful) {
+ // | var obj = new Stateful();
+ // | obj.watch("foo", function(){
+ // | console.log("foo changed to " + this.get("foo"));
+ // | });
+ // | obj.set("foo","bar");
// | });
- // | obj.set("foo","bar");
// _attrPairNames: Hash
// Used across all instances a hash to cache attribute names and their getter
@@ -64,10 +66,12 @@ return declare("dojo.Stateful", null, {
// Get a named property on a Stateful object. The property may
// potentially be retrieved via a getter method in subclasses. In the base class
// this just retrieves the object's property.
- // For example:
- // | stateful = new dojo.Stateful({foo: 3});
- // | stateful.get("foo") // returns 3
- // | stateful.foo // returns 3
+ // example:
+ // | require(["dojo/Stateful", function(Stateful) {
+ // | var stateful = new Stateful({foo: 3});
+ // | stateful.get("foo") // returns 3
+ // | stateful.foo // returns 3
+ // | });
return this._get(name, this._getAttrNames(name)); //Any
},
@@ -83,18 +87,19 @@ return declare("dojo.Stateful", null, {
// description:
// Sets named properties on a stateful object and notifies any watchers of
// the property. A programmatic setter may be defined in subclasses.
- // For example:
- // | stateful = new dojo.Stateful();
- // | stateful.watch(function(name, oldValue, value){
- // | // this will be called on the set below
- // | }
- // | stateful.set(foo, 5);
- //
+ // example:
+ // | require(["dojo/Stateful", function(Stateful) {
+ // | var stateful = new Stateful();
+ // | stateful.watch(function(name, oldValue, value){
+ // | // this will be called on the set below
+ // | }
+ // | stateful.set(foo, 5);
// set() may also be called with a hash of name/value pairs, ex:
- // | myObj.set({
- // | foo: "Howdy",
- // | bar: 3
- // | })
+ // | stateful.set({
+ // | foo: "Howdy",
+ // | bar: 3
+ // | });
+ // | });
// This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
// If an object is used, iterate through object
diff --git a/_base/Color.js b/_base/Color.js
index 6f416e5..304bbe6 100644
--- a/_base/Color.js
+++ b/_base/Color.js
@@ -8,17 +8,22 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
//
// example:
// Work with a Color instance:
- // | var c = new Color();
- // | c.setColor([0,0,0]); // black
- // | var hex = c.toHex(); // #000000
+ // | require(["dojo/_base/color"], function(Color){
+ // | var c = new Color();
+ // | c.setColor([0,0,0]); // black
+ // | var hex = c.toHex(); // #000000
+ // | });
//
// example:
// Work with a node's color:
- // | var color = dojo.style("someNode", "backgroundColor");
- // | var n = new Color(color);
- // | // adjust the color some
- // | n.r *= .5;
- // | console.log(n.toString()); // rgb(128, 255, 255);
+ // |
+ // | require(["dojo/_base/color", "dojo/dom-style"], function(Color, domStyle){
+ // | var color = domStyle("someNode", "backgroundColor");
+ // | var n = new Color(color);
+ // | // adjust the color some
+ // | n.r *= .5;
+ // | console.log(n.toString()); // rgb(128, 255, 255);
+ // | });
if(color){ this.setColor(color); }
};
@@ -59,8 +64,10 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// and sets this color instance to that value.
//
// example:
- // | var c = new Color(); // no color
- // | c.setColor("#ededed"); // greyish
+ // | require(["dojo/_base/color"], function(Color){
+ // | var c = new Color(); // no color
+ // | c.setColor("#ededed"); // greyish
+ // | });
if(lang.isString(color)){
Color.fromString(color, this);
}else if(lang.isArray(color)){
@@ -83,8 +90,10 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// summary:
// Returns 3 component array of rgb values
// example:
- // | var c = new Color("#000000");
- // | console.log(c.toRgb()); // [0,0,0]
+ // | require(["dojo/_base/color"], function(Color){
+ // | var c = new Color("#000000");
+ // | console.log(c.toRgb()); // [0,0,0]
+ // | });
var t = this;
return [t.r, t.g, t.b]; // Array
},
@@ -99,7 +108,9 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// summary:
// Returns a CSS color string in hexadecimal representation
// example:
- // | console.log(new Color([0,0,0]).toHex()); // #000000
+ // | require(["dojo/_base/color"], function(Color){
+ // | console.log(new Color([0,0,0]).toHex()); // #000000
+ // | });
var arr = ArrayUtil.map(["r", "g", "b"], function(x){
var s = this[x].toString(16);
return s.length < 2 ? "0" + s : s;
@@ -110,8 +121,10 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// summary:
// Returns a css color string in rgb(a) representation
// example:
- // | var c = new Color("#FFF").toCss();
- // | console.log(c); // rgb('255','255','255')
+ // | require(["dojo/_base/color"], function(Color){
+ // | var c = new Color("#FFF").toCss();
+ // | console.log(c); // rgb('255','255','255')
+ // | });
var t = this, rgb = t.r + ", " + t.g + ", " + t.b;
return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")"; // String
},
@@ -161,10 +174,10 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// A Color object. If obj is passed, it will be the return value.
//
// example:
- // | var thing = dojo.colorFromHex("#ededed"); // grey, longhand
- //
- // example:
- // | var thing = dojo.colorFromHex("#000"); // black, shorthand
+ // | require(["dojo/_base/color"], function(Color){
+ // | var thing = new Color().fromHex("#ededed"); // grey, longhand
+ // | var thing2 = new Color().fromHex("#000"); // black, shorthand
+ // | });
var t = obj || new Color(),
bits = (color.length == 4) ? 4 : 8,
mask = (1 << bits) - 1;
@@ -186,7 +199,9 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array
// Builds a `Color` from a 3 or 4 element array, mapping each
// element in sequence to the rgb(a) values of the color.
// example:
- // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
+ // | require(["dojo/_base/color"], function(Color){
+ // | var myColor = new Color().fromArray([237,237,237,0.5]); // grey, 50% alpha
+ // | });
// returns:
// A Color object. If obj is passed, it will be the return value.
var t = obj || new Color();
diff --git a/dom-attr.js b/dom-attr.js
index 677c458..76791b9 100644
--- a/dom-attr.js
+++ b/dom-attr.js
@@ -13,7 +13,7 @@ define(["exports", "./sniff", "./_base/lang", "./dom", "./dom-style", "./dom-pro
// This module will be obsolete soon. Use dojo/prop instead.
- // dojo.attr() should conform to http://www.w3.org/TR/DOM-Level-2-Core/
+ // dojo/dom-attr.get() should conform to http://www.w3.org/TR/DOM-Level-2-Core/
// attribute-related functions (to be obsolete soon)
@@ -73,9 +73,12 @@ define(["exports", "./sniff", "./_base/lang", "./dom", "./dom-style", "./dom-pro
//
// example:
// | // get the current value of the "foo" attribute on a node
- // | dojo.getAttr(dojo.byId("nodeId"), "foo");
- // | // or we can just pass the id:
- // | dojo.getAttr("nodeId", "foo");
+ // | require(["dojo/dom-attr", "dojo/dom"], function(domAttr, dom){
+ // | domAttr.get(dom.byId("nodeId"), "foo");
+ // | // or we can just pass the id:
+ // | domAttr.get("nodeId", "foo");
+ // | });
+ // |
node = dom.byId(node);
var lc = name.toLowerCase(),
@@ -123,44 +126,20 @@ define(["exports", "./sniff", "./_base/lang", "./dom", "./dom-style", "./dom-pro
//
// example:
// | // use attr() to set the tab index
- // | dojo.setAttr("nodeId", "tabIndex", 3);
- //
- // example:
- // Set multiple values at once, including event handlers:
- // | dojo.setAttr("formId", {
- // | "foo": "bar",
- // | "tabIndex": -1,
- // | "method": "POST",
- // | "onsubmit": function(e){
- // | // stop submitting the form. Note that the IE behavior
- // | // of returning true or false will have no effect here
- // | // since our handler is connect()ed to the built-in
- // | // onsubmit behavior and so we need to use
- // | // dojo.stopEvent() to ensure that the submission
- // | // doesn't proceed.
- // | dojo.stopEvent(e);
- // |
- // | // submit the form with Ajax
- // | dojo.xhrPost({ form: "formId" });
- // | }
+ // | require(["dojo/dom-attr"], function(domAttr){
+ // | domAttr.set("nodeId", "tabIndex", 3);
// | });
//
// example:
- // Style is s special case: Only set with an object hash of styles
- // | dojo.setAttr("someNode",{
- // | id:"bar",
- // | style:{
- // | width:"200px", height:"100px", color:"#000"
+ // Set multiple values at once, including event handlers:
+ // | require(["dojo/dom-attr"],
+ // | function(domAttr){
+ // | domAttr.set("formId", {
+ // | "foo": "bar",
+ // | "tabIndex": -1,
+ // | "method": "POST"
// | }
// | });
- //
- // example:
- // Again, only set style as an object hash of styles:
- // | var obj = { color:"#fff", backgroundColor:"#000" };
- // | dojo.setAttr("someNode", "style", obj);
- // |
- // | // though shorter to use `dojo.style()` in this case:
- // | dojo.setStyle("someNode", obj);
node = dom.byId(node);
if(arguments.length == 2){ // inline'd type check
diff --git a/dom-construct.js b/dom-construct.js
index 435ed15..f58b0a6 100644
--- a/dom-construct.js
+++ b/dom-construct.js
@@ -82,12 +82,14 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./do
// the HTML fragment
// doc: DocumentNode?
// optional document to use when creating DOM nodes, defaults to
- // dojo.doc if not specified.
+ // dojo/_base/window.doc if not specified.
// returns:
// Document fragment, unless it's a single node in which case it returns the node itself
// example:
// Create a table row:
- // | var tr = dojo.toDom("<tr><td>First!</td></tr>");
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | var tr = domConstruct.toDom("<tr><td>First!</td></tr>");
+ // | });
doc = doc || win.doc;
var masterId = doc[masterName];
@@ -158,19 +160,28 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./do
// returns: DOMNode
// Returned values is the first argument resolved to a DOM node.
//
- // .place() is also a method of `dojo/NodeList`, allowing `dojo.query` node lookups.
+ // .place() is also a method of `dojo/NodeList`, allowing `dojo/query` node lookups.
// example:
// Place a node by string id as the last child of another node by string id:
- // | dojo.place("someNode", "anotherNode");
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.place("someNode", "anotherNode");
+ // | });
// example:
// Place a node by string id before another node by string id
- // | dojo.place("someNode", "anotherNode", "before");
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.place("someNode", "anotherNode", "before");
+ // | });
// example:
// Create a Node, and place it in the body element (last child):
- // | dojo.place("<div></div>", dojo.body());
+ // | require(["dojo/dom-construct", "dojo/_base/window"
+ // | ], function(domConstruct, win){
+ // | domConstruct.place("<div></div>", win.body());
+ // | });
// example:
// Put a new LI as the first child of a list by id:
- // | dojo.place("<li></li>", "someUl", "first");
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.place("<li></li>", "someUl", "first");
+ // | });
refNode = dom.byId(refNode);
if(typeof node == "string"){ // inline'd type check
@@ -243,35 +254,39 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./do
// 'refNode' is required if a 'pos' is specified.
// example:
// Create a DIV:
- // | var n = dojo.create("div");
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | var n = domConstruct.create("div");
+ // | });
//
// example:
// Create a DIV with content:
- // | var n = dojo.create("div", { innerHTML:"<p>hi</p>" });
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | var n = domConstruct.create("div", { innerHTML:"<p>hi</p>" });
+ // | });
//
// example:
// Place a new DIV in the BODY, with no attributes set
- // | var n = dojo.create("div", null, dojo.body());
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | var n = domConstruct.create("div", null, dojo.body());
+ // | });
//
// example:
// Create an UL, and populate it with LI's. Place the list as the first-child of a
// node with id="someId":
- // | var ul = dojo.create("ul", null, "someId", "first");
- // | var items = ["one", "two", "three", "four"];
- // | dojo.forEach(items, function(data){
- // | dojo.create("li", { innerHTML: data }, ul);
+ // | require(["dojo/dom-construct", "dojo/_base/array"],
+ // | function(domConstruct, arrayUtil){
+ // | var ul = domConstruct.create("ul", null, "someId", "first");
+ // | var items = ["one", "two", "three", "four"];
+ // | arrayUtil.forEach(items, function(data){
+ // | domConstruct.create("li", { innerHTML: data }, ul);
+ // | });
// | });
//
// example:
// Create an anchor, with an href. Place in BODY:
- // | dojo.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body());
- //
- // example:
- // Create a `dojo/NodeList()` from a new element (for syntactic sugar):
- // | dojo.query(dojo.create('div'))
- // | .addClass("newDiv")
- // | .onclick(function(e){ console.log('clicked', e.target) })
- // | .place("#someNode"); // redundant, but cleaner.
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body());
+ // | });
var doc = win.doc;
if(refNode){
@@ -304,17 +319,15 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./do
}
exports.empty = function empty(/*DOMNode|String*/ node){
- // summary:
- // safely removes all children of the node.
- // node: DOMNode|String
- // a reference to a DOM node or an id.
- // example:
- // Destroy node's children byId:
- // | dojo.empty("someId");
- //
- // example:
- // Destroy all nodes' children in a list by reference:
- // | dojo.query(".someNode").forEach(dojo.empty);
+ // summary:
+ // safely removes all children of the node.
+ // node: DOMNode|String
+ // a reference to a DOM node or an id.
+ // example:
+ // Destroy node's children byId:
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.empty("someId");
+ // | });
_empty(dom.byId(node));
};
@@ -347,11 +360,9 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./do
//
// example:
// Destroy a node byId:
- // | dojo.destroy("someId");
- //
- // example:
- // Destroy all nodes in a list by reference:
- // | dojo.query(".someNode").forEach(dojo.destroy);
+ // | require(["dojo/dom-construct"], function(domConstruct){
+ // | domConstruct.destroy("someId");
+ // | });
node = dom.byId(node);
if(!node){ return; }
diff --git a/dom-geometry.js b/dom-geometry.js
index 4943dac..3016c4e 100644
--- a/dom-geometry.js
+++ b/dom-geometry.js
@@ -49,8 +49,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -78,8 +78,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -108,8 +108,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -143,8 +143,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -177,8 +177,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -226,8 +226,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -333,8 +333,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -367,8 +367,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -560,8 +560,8 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
// computedStyle: Object?
// This parameter accepts computed styles object.
// If this parameter is omitted, the functions will call
- // dojo.getComputedStyle to get one. It is a better way, calling
- // dojo.computedStyle once, and then pass the reference to this
+ // dojo/dom-style.getComputedStyle to get one. It is a better way, calling
+ // dojo/dom-style.getComputedStyle once, and then pass the reference to this
// computedStyle parameter. Wherever possible, reuse the returned
// object of dojo/dom-style.getComputedStyle().
@@ -585,12 +585,12 @@ define(["./sniff", "./_base/window","./dom", "./dom-style"],
}
if(!has("dom-addeventlistener")){
// old IE version
- // FIXME: scroll position query is duped from dojo.html to
+ // FIXME: scroll position query is duped from dojo/_base/html to
// avoid dependency on that entire module. Now that HTML is in
// Base, we should convert back to something similar there.
var se = event.target;
var doc = (se && se.ownerDocument) || document;
- // DO NOT replace the following to use dojo.body(), in IE, document.documentElement should be used
+ // DO NOT replace the following to use dojo/_base/window.body(), in IE, document.documentElement should be used
// here rather than document.body
var docBody = has("quirks") ? doc.body : doc.documentElement;
var offset = geom.getIeDocumentElementOffset(doc);
diff --git a/dom-prop.js b/dom-prop.js
index ccc04c5..f6f07ab 100644
--- a/dom-prop.js
+++ b/dom-prop.js
@@ -42,9 +42,11 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/lang", "./dom", "./dom-
//
// example:
// | // get the current value of the "foo" property on a node
- // | dojo.getProp(dojo.byId("nodeId"), "foo");
- // | // or we can just pass the id:
- // | dojo.getProp("nodeId", "foo");
+ // | require(["dojo/dom-prop", "dojo/dom"], function(domProp, dom){
+ // | domProp.get(dom.byId("nodeId"), "foo");
+ // | // or we can just pass the id:
+ // | domProp.get("nodeId", "foo");
+ // | });
node = dom.byId(node);
var lc = name.toLowerCase(), propName = exports.names[lc] || name;
@@ -78,45 +80,19 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/lang", "./dom", "./dom-
//
// example:
// | // use prop() to set the tab index
- // | dojo.setProp("nodeId", "tabIndex", 3);
- // |
- //
- // example:
- // Set multiple values at once, including event handlers:
- // | dojo.setProp("formId", {
- // | "foo": "bar",
- // | "tabIndex": -1,
- // | "method": "POST",
- // | "onsubmit": function(e){
- // | // stop submitting the form. Note that the IE behavior
- // | // of returning true or false will have no effect here
- // | // since our handler is connect()ed to the built-in
- // | // onsubmit behavior and so we need to use
- // | // dojo.stopEvent() to ensure that the submission
- // | // doesn't proceed.
- // | dojo.stopEvent(e);
- // |
- // | // submit the form with Ajax
- // | dojo.xhrPost({ form: "formId" });
- // | }
+ // | require(["dojo/dom-prop"], function(domProp){
+ // | domProp.set("nodeId", "tabIndex", 3);
// | });
//
// example:
- // Style is s special case: Only set with an object hash of styles
- // | dojo.setProp("someNode",{
- // | id:"bar",
- // | style:{
- // | width:"200px", height:"100px", color:"#000"
- // | }
+ // Set multiple values at once, including event handlers:
+ // | require(["dojo/dom-prop"], function(domProp){
+ // | domProp.set("formId", {
+ // | "foo": "bar",
+ // | "tabIndex": -1,
+ // | "method": "POST",
+ // | });
// | });
- //
- // example:
- // Again, only set style as an object hash of styles:
- // | var obj = { color:"#fff", backgroundColor:"#000" };
- // | dojo.setProp("someNode", "style", obj);
- // |
- // | // though shorter to use `dojo.style()` in this case:
- // | dojo.style("someNode", obj);
node = dom.byId(node);
var l = arguments.length;
diff --git a/dom-style.js b/dom-style.js
index 042cfd6..2d498a1 100644
--- a/dom-style.js
+++ b/dom-style.js
@@ -66,19 +66,23 @@ define(["./sniff", "./dom"], function(has, dom){
// Note also that this method is expensive. Wherever possible,
// reuse the returned object.
//
- // Use the dojo.style() method for more consistent (pixelized)
+ // Use the dojo/dom-style.get() method for more consistent (pixelized)
// return values.
//
// node: DOMNode
// A reference to a DOM node. Does NOT support taking an
// ID string for speed reasons.
// example:
- // | dojo.getComputedStyle(dojo.byId('foo')).borderWidth;
+ // | require(["dojo/dom-style", "dojo/dom"], function(domStyle, dom){
+ // | domStyle.getComputedStyle(dom.byId('foo')).borderWidth;
+ // | });
//
// example:
// Reusing the returned object, avoiding multiple lookups:
- // | var cs = dojo.getComputedStyle(dojo.byId("someNode"));
- // | var w = cs.width, h = cs.height;
+ // | require(["dojo/dom-style", "dojo/dom"], function(domStyle, dom){
+ // | var cs = domStyle.getComputedStyle(dom.byId("someNode"));
+ // | var w = cs.width, h = cs.height;
+ // | });
return; // CSS2Properties
};
=====*/
@@ -227,8 +231,8 @@ define(["./sniff", "./dom"], function(has, dom){
// Also when getting values, use specific style names,
// like "borderBottomWidth" instead of "border" since compound values like
// "border" are not necessarily reflected as expected.
- // If you want to get node dimensions, use `dojo.marginBox()`,
- // `dojo.contentBox()` or `dojo.position()`.
+ // If you want to get node dimensions, use `dojo/dom-geometry.getMarginBox()`,
+ // `dojo/dom-geometry.getContentBox()` or `dojo/dom-geometry.getPosition()`.
// node: DOMNode|String
// id or reference to node to get style for
// name: String?
@@ -236,11 +240,15 @@ define(["./sniff", "./dom"], function(has, dom){
// example:
// Passing only an ID or node returns the computed style object of
// the node:
- // | dojo.getStyle("thinger");
+ // | require(["dojo/dom-style", "dojo/dom"], function(domStyle, dom){
+ // | domStyle.get("thinger");
+ // | });
// example:
// Passing a node and a style property returns the current
// normalized, computed value for that property:
- // | dojo.getStyle("thinger", "opacity"); // 1 by default
+ // | require(["dojo/dom-style", "dojo/dom"], function(domStyle, dom){
+ // | domStyle.get("thinger", "opacity"); // 1 by default
+ // | });
var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
if(l == 2 && op){
@@ -269,32 +277,41 @@ define(["./sniff", "./dom"], function(has, dom){
// example:
// Passing a node, a style property, and a value changes the
// current display of the node and returns the new computed value
- // | dojo.setStyle("thinger", "opacity", 0.5); // == 0.5
+ // | require(["dojo/dom-style"], function(domStyle){
+ // | domStyle.set("thinger", "opacity", 0.5); // == 0.5
+ // | });
//
// example:
// Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
- // | dojo.setStyle("thinger", {
- // | "opacity": 0.5,
- // | "border": "3px solid black",
- // | "height": "300px"
+ // | require(["dojo/dom-style"], function(domStyle){
+ // | domStyle.set("thinger", {
+ // | "opacity": 0.5,
+ // | "border": "3px solid black",
+ // | "height": "300px"
+ // | });
// | });
//
// example:
// When the CSS style property is hyphenated, the JavaScript property is camelCased.
// font-size becomes fontSize, and so on.
- // | dojo.setStyle("thinger",{
- // | fontSize:"14pt",
- // | letterSpacing:"1.2em"
+ // | require(["dojo/dom-style", "dojo/dom"], function(domStyle, dom){
+ // | domStyle.set("thinger",{
+ // | fontSize:"14pt",
+ // | letterSpacing:"1.2em"
+ // | });
// | });
//
// example:
// dojo/NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
- // dojo.style() on every element of the list. See: `dojo.query()` and `dojo/NodeList`
- // | dojo.query(".someClassName").style("visibility","hidden");
- // | // or
- // | dojo.query("#baz > div").style({
- // | opacity:0.75,
- // | fontSize:"13pt"
+ // dojo/dom-style.get() on every element of the list. See: `dojo/query` and `dojo/NodeList`
+ // | require(["dojo/dom-style", "dojo/query", "dojo/NodeList-dom"],
+ // | function(domStyle, query){
+ // | query(".someClassName").style("visibility","hidden");
+ // | // or
+ // | query("#baz > div").style({
+ // | opacity:0.75,
+ // | fontSize:"13pt"
+ // | });
// | });
var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
diff --git a/dom.js b/dom.js
index 4c1ec89..5537c0c 100644
--- a/dom.js
+++ b/dom.js
@@ -56,33 +56,39 @@ define(["./sniff", "./_base/window"],
}
/*=====
dom.byId = function(id, doc){
- // summary:
- // Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
- // if not found. If `id` is a DomNode, this function is a no-op.
- //
- // id: String|DOMNode
- // A string to match an HTML id attribute or a reference to a DOM Node
- //
- // doc: Document?
- // Document to work in. Defaults to the current value of
- // dojo.doc. Can be used to retrieve
- // node references from other documents.
- //
- // example:
- // Look up a node by ID:
- // | var n = dojo.byId("foo");
- //
- // example:
- // Check if a node exists, and use it.
- // | var n = dojo.byId("bar");
- // | if(n){ doStuff() ... }
- //
- // example:
- // Allow string or DomNode references to be passed to a custom function:
- // | var foo = function(nodeOrId){
- // | nodeOrId = dojo.byId(nodeOrId);
- // | // ... more stuff
- // | }
+ // summary:
+ // Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
+ // if not found. If `id` is a DomNode, this function is a no-op.
+ //
+ // id: String|DOMNode
+ // A string to match an HTML id attribute or a reference to a DOM Node
+ //
+ // doc: Document?
+ // Document to work in. Defaults to the current value of
+ // dojo/_base/window.doc. Can be used to retrieve
+ // node references from other documents.
+ //
+ // example:
+ // Look up a node by ID:
+ // | require(["dojo/dom"], function(dom){
+ // | var n = dom.byId("foo");
+ // | });
+ //
+ // example:
+ // Check if a node exists, and use it.
+ // | require(["dojo/dom"], function(dom){
+ // | var n = dom.byId("bar");
+ // | if(n){ doStuff() ... }
+ // | });
+ //
+ // example:
+ // Allow string or DomNode references to be passed to a custom function:
+ // | require(["dojo/dom"], function(dom){
+ // | var foo = function(nodeOrId){
+ // | nodeOrId = dom.byId(nodeOrId);
+ // | // ... more stuff
+ // | }
+ // | });
};
=====*/
@@ -96,7 +102,9 @@ define(["./sniff", "./_base/window"],
//
// example:
// Test is node id="bar" is a descendant of node id="foo"
- // | if(dojo.isDescendant("bar", "foo")){ ... }
+ // | require(["dojo/dom"], function(dom){
+ // | if(dom.isDescendant("bar", "foo")){ ... }
+ // | });
try{
node = dom.byId(node);
@@ -149,10 +157,14 @@ define(["./sniff", "./_base/window"],
// allows selection.
// example:
// Make the node id="bar" unselectable
- // | dojo.setSelectable("bar");
+ // | require(["dojo/dom"], function(dom){
+ // | dom.setSelectable("bar");
+ // | });
// example:
// Make the node id="bar" selectable
- // | dojo.setSelectable("bar", true);
+ // | require(["dojo/dom"], function(dom){
+ // | dom.setSelectable("bar", true);
+ // | });
};
=====*/
diff --git a/fx.js b/fx.js
index 4eb7998..854c305 100644
--- a/fx.js
+++ b/fx.js
@@ -148,21 +148,23 @@ define([
coreFx.chain = function(/*dojo/_base/fx.Animation[]*/ animations){
// summary:
- // Chain a list of `dojo.Animation`s to run in sequence
+ // Chain a list of `dojo/_base/fx.Animation`s to run in sequence
//
// description:
- // Return a `dojo.Animation` which will play all passed
- // `dojo.Animation` instances in sequence, firing its own
+ // Return a `dojo/_base/fx.Animation` which will play all passed
+ // `dojo/_base/fx.Animation` instances in sequence, firing its own
// synthesized events simulating a single animation. (eg:
// onEnd of this animation means the end of the chain,
// not the individual animations within)
//
// example:
// Once `node` is faded out, fade in `otherNode`
- // | fx.chain([
- // | dojo.fadeIn({ node:node }),
- // | dojo.fadeOut({ node:otherNode })
- // | ]).play();
+ // | require(["dojo/fx"], function(fx){
+ // | fx.chain([
+ // | fx.fadeIn({ node:node }),
+ // | fx.fadeOut({ node:otherNode })
+ // | ]).play();
+ // | });
//
return new _chain(animations); // dojo/_base/fx.Animation
};
@@ -243,30 +245,34 @@ define([
coreFx.combine = function(/*dojo/_base/fx.Animation[]*/ animations){
// summary:
- // Combine a list of `dojo.Animation`s to run in parallel
+ // Combine a list of `dojo/_base/fx.Animation`s to run in parallel
//
// description:
- // Combine an array of `dojo.Animation`s to run in parallel,
- // providing a new `dojo.Animation` instance encompasing each
+ // Combine an array of `dojo/_base/fx.Animation`s to run in parallel,
+ // providing a new `dojo/_base/fx.Animation` instance encompasing each
// animation, firing standard animation events.
//
// example:
// Fade out `node` while fading in `otherNode` simultaneously
- // | fx.combine([
- // | dojo.fadeIn({ node:node }),
- // | dojo.fadeOut({ node:otherNode })
- // | ]).play();
+ // | require(["dojo/fx"], function(fx){
+ // | fx.combine([
+ // | fx.fadeIn({ node:node }),
+ // | fx.fadeOut({ node:otherNode })
+ // | ]).play();
+ // | });
//
// example:
// When the longest animation ends, execute a function:
- // | var anim = fx.combine([
- // | dojo.fadeIn({ node: n, duration:700 }),
- // | dojo.fadeOut({ node: otherNode, duration: 300 })
- // | ]);
- // | aspect.after(anim, "onEnd", function(){
- // | // overall animation is done.
- // | }, true);
- // | anim.play(); // play the animation
+ // | require(["dojo/fx"], function(fx){
+ // | var anim = fx.combine([
+ // | fx.fadeIn({ node: n, duration:700 }),
+ // | fx.fadeOut({ node: otherNode, duration: 300 })
+ // | ]);
+ // | aspect.after(anim, "onEnd", function(){
+ // | // overall animation is done.
+ // | }, true);
+ // | anim.play(); // play the animation
+ // | });
//
return new _combine(animations); // dojo/_base/fx.Animation
};
@@ -282,13 +288,16 @@ define([
// Node must have no margin/border/padding.
//
// args: Object
- // A hash-map of standard `dojo.Animation` constructor properties
+ // A hash-map of standard `dojo/_base/fx.Animation` constructor properties
// (such as easing: node: duration: and so on)
//
// example:
- // | fx.wipeIn({
- // | node:"someId"
- // | }).play()
+ // | require(["dojo/fx"], function(fx){
+ // | fx.wipeIn({
+ // | node:"someId"
+ // | }).play()
+ // | });
+
var node = args.node = dom.byId(args.node), s = node.style, o;
var anim = baseFx.animateProperty(lang.mixin({
@@ -336,11 +345,13 @@ define([
// from it's current height to 1px, and then hide it.
//
// args: Object
- // A hash-map of standard `dojo.Animation` constructor properties
+ // A hash-map of standard `dojo/_base/fx.Animation` constructor properties
// (such as easing: node: duration: and so on)
//
// example:
- // | fx.wipeOut({ node:"someId" }).play()
+ // | require(["dojo/fx"], function(fx){
+ // | fx.wipeOut({ node:"someId" }).play()
+ // | });
var node = args.node = dom.byId(args.node), s = node.style, o;
@@ -378,7 +389,7 @@ define([
// the position defined by (args.left, args.top).
//
// args: Object
- // A hash-map of standard `dojo.Animation` constructor properties
+ // A hash-map of standard `dojo/_base/fx.Animation` constructor properties
// (such as easing: node: duration: and so on). Special args members
// are `top` and `left`, which indicate the new position to slide to.
//
diff --git a/hash.js b/hash.js
index f961bfb..2787a7a 100644
--- a/hash.js
+++ b/hash.js
@@ -158,7 +158,7 @@ define(["./_base/kernel", "require", "./_base/config", "./aspect", "./_base/lang
ifrSrc = config.dojoBlankHtmlUrl || require.toUrl("./resources/blank.html");
if(config.useXDomain && !config.dojoBlankHtmlUrl){
- console.warn("dojo.hash: When using cross-domain Dojo builds,"
+ console.warn("dojo/hash: When using cross-domain Dojo builds,"
+ " please save dojo/resources/blank.html to your domain and set djConfig.dojoBlankHtmlUrl"
+ " to the path on your domain to blank.html");
}
@@ -195,7 +195,7 @@ define(["./_base/kernel", "require", "./_base/config", "./aspect", "./_base/lang
}catch(e){
//permission denied - server cannot be reached.
ifrOffline = true;
- console.error("dojo.hash: Error adding history entry. Server unreachable.");
+ console.error("dojo/hash: Error adding history entry. Server unreachable.");
}
}
var hash = _getHash();
diff --git a/html.js b/html.js
index 56c4e5d..9f09672 100644
--- a/html.js
+++ b/html.js
@@ -326,9 +326,12 @@ define(["./_base/kernel", "./_base/lang", "./_base/array", "./_base/declare", ".
// may be a better choice for simple HTML insertion.
// description:
// Unless you need to use the params capabilities of this method, you should use
- // dojo/dom-construct..place(cont, node, "only"). dojo/dom-construct..place() has more robust support for injecting
+ // dojo/dom-construct.place(cont, node, "only"). dojo/dom-construct..place() has more robust support for injecting
// an HTML string into the DOM, but it only handles inserting an HTML string as DOM
// elements, or inserting a DOM node. dojo/dom-construct..place does not handle NodeList insertions
+ // dojo/dom-construct.place(cont, node, "only"). dojo/dom-construct.place() has more robust support for injecting
+ // an HTML string into the DOM, but it only handles inserting an HTML string as DOM
+ // elements, or inserting a DOM node. dojo/dom-construct.place does not handle NodeList insertions
// or the other capabilities as defined by the params object for this method.
// node:
// the parent element that will receive the content
diff --git a/on.js b/on.js
index 16c8803..15bb4b2 100644
--- a/on.js
+++ b/on.js
@@ -183,7 +183,7 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], fu
var matchesTarget = typeof selector == "function" ? {matches: selector} : this,
bubble = eventType.bubble;
function select(eventTarget){
- // see if we have a valid matchesTarget or default to dojo.query
+ // see if we have a valid matchesTarget or default to dojo/query
matchesTarget = matchesTarget && matchesTarget.matches ? matchesTarget : dojo.query;
// there is a selector, so make sure it matches
while(!matchesTarget.matches(eventTarget, selector, target)){
@@ -251,17 +251,20 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], fu
// to appear in a textbox.
// example:
// To fire our own click event
- // | on.emit(dojo.byId("button"), "click", {
- // | cancelable: true,
- // | bubbles: true,
- // | screenX: 33,
- // | screenY: 44
- // | });
+ // | require(["dojo/on", "dojo/dom"
+ // | ], function(on, dom){
+ // | on.emit(dom.byId("button"), "click", {
+ // | cancelable: true,
+ // | bubbles: true,
+ // | screenX: 33,
+ // | screenY: 44
+ // | });
// We can also fire our own custom events:
- // | on.emit(dojo.byId("slider"), "slide", {
- // | cancelable: true,
- // | bubbles: true,
- // | direction: "left-to-right"
+ // | on.emit(dom.byId("slider"), "slide", {
+ // | cancelable: true,
+ // | bubbles: true,
+ // | direction: "left-to-right"
+ // | });
// | });
var args = slice.call(arguments, 2);
var method = "on" + type;
diff --git a/query.js b/query.js
index d334a95..ed57550 100644
--- a/query.js
+++ b/query.js
@@ -56,7 +56,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
var adaptAsMap = function(f, o){
// summary:
// adapts a single node function to be used in the map-type
- // actions. The return is a new array of values, as via `dojo.map`
+ // actions. The return is a new array of values, as via `dojo/_base/array.map`
// f: Function
// a function to adapt
// o: Object?
@@ -103,78 +103,62 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// Array-like object which adds syntactic
// sugar for chaining, common iteration operations, animation, and
// node manipulation. NodeLists are most often returned as the
- // result of dojo.query() calls.
+ // result of dojo/query() calls.
// description:
// NodeList instances provide many utilities that reflect
// core Dojo APIs for Array iteration and manipulation, DOM
// manipulation, and event handling. Instead of needing to dig up
- // functions in the dojo.* namespace, NodeLists generally make the
+ // functions in the dojo package, NodeLists generally make the
// full power of Dojo available for DOM manipulation tasks in a
// simple, chainable way.
// example:
// create a node list from a node
- // | new query.NodeList(dojo.byId("foo"));
+ // | require(["dojo/query", "dojo/dom"
+ // | ], function(query, dom){
+ // | query.NodeList(dom.byId("foo"));
+ // | });
// example:
// get a NodeList from a CSS query and iterate on it
- // | var l = dojo.query(".thinger");
- // | l.forEach(function(node, index, nodeList){
- // | console.log(index, node.innerHTML);
+ // | require(["dojo/on", "dojo/dom"
+ // | ], function(on, dom){
+ // | var l = query(".thinger");
+ // | l.forEach(function(node, index, nodeList){
+ // | console.log(index, node.innerHTML);
+ // | });
// | });
// example:
// use native and Dojo-provided array methods to manipulate a
// NodeList without needing to use dojo.* functions explicitly:
- // | var l = dojo.query(".thinger");
- // | // since NodeLists are real arrays, they have a length
- // | // property that is both readable and writable and
- // | // push/pop/shift/unshift methods
- // | console.log(l.length);
- // | l.push(dojo.create("span"));
- // |
- // | // dojo's normalized array methods work too:
- // | console.log( l.indexOf(dojo.byId("foo")) );
- // | // ...including the special "function as string" shorthand
- // | console.log( l.every("item.nodeType == 1") );
+ // | require(["dojo/query", "dojo/dom-construct", "dojo/dom"
+ // | ], function(query, domConstruct, dom){
+ // | var l = query(".thinger");
+ // | // since NodeLists are real arrays, they have a length
+ // | // property that is both readable and writable and
+ // | // push/pop/shift/unshift methods
+ // | console.log(l.length);
+ // | l.push(domConstruct.create("span"));
// |
- // | // NodeLists can be [..] indexed, or you can use the at()
- // | // function to get specific items wrapped in a new NodeList:
- // | var node = l[3]; // the 4th element
- // | var newList = l.at(1, 3); // the 2nd and 4th elements
- // example:
- // the style functions you expect are all there too:
- // | // style() as a getter...
- // | var borders = dojo.query(".thinger").style("border");
- // | // ...and as a setter:
- // | dojo.query(".thinger").style("border", "1px solid black");
- // | // class manipulation
- // | dojo.query("li:nth-child(even)").addClass("even");
- // | // even getting the coordinates of all the items
- // | var coords = dojo.query(".thinger").coords();
- // example:
- // DOM manipulation functions from the dojo.* namespace area also available:
- // | // remove all of the elements in the list from their
- // | // parents (akin to "deleting" them from the document)
- // | dojo.query(".thinger").orphan();
- // | // place all elements in the list at the front of #foo
- // | dojo.query(".thinger").place("foo", "first");
- // example:
- // Event handling couldn't be easier. `dojo.connect` is mapped in,
- // and shortcut handlers are provided for most DOM events:
- // | // like dojo.connect(), but with implicit scope
- // | dojo.query("li").connect("onclick", console, "log");
+ // | // dojo's normalized array methods work too:
+ // | console.log( l.indexOf(dom.byId("foo")) );
+ // | // ...including the special "function as string" shorthand
+ // | console.log( l.every("item.nodeType == 1") );
// |
- // | // many common event handlers are already available directly:
- // | dojo.query("li").onclick(console, "log");
- // | var toggleHovered = dojo.hitch(dojo, "toggleClass", "hovered");
- // | dojo.query("p")
- // | .onmouseenter(toggleHovered)
- // | .onmouseleave(toggleHovered);
+ // | // NodeLists can be [..] indexed, or you can use the at()
+ // | // function to get specific items wrapped in a new NodeList:
+ // | var node = l[3]; // the 4th element
+ // | var newList = l.at(1, 3); // the 2nd and 4th elements
+ // | });
// example:
// chainability is a key advantage of NodeLists:
- // | dojo.query(".thinger")
- // | .onclick(function(e){ /* ... */ })
- // | .at(1, 3, 8) // get a subset
- // | .style("padding", "5px")
- // | .forEach(console.log);
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query(".thinger")
+ // | .onclick(function(e){ /* ... */ })
+ // | .at(1, 3, 8) // get a subset
+ // | .style("padding", "5px")
+ // | .forEach(console.log);
+ // | });
+
var isNew = this instanceof nl && has("array-extensible");
if(typeof array == "number"){
array = Array(array);
@@ -250,20 +234,22 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// example:
// How to make a `dojo/NodeList` method that only returns the third node in
// the dojo/NodeList but allows access to the original NodeList by using this._stash:
- // | dojo.extend(NodeList, {
- // | third: function(){
- // | var newNodeList = NodeList(this[2]);
- // | return newNodeList._stash(this);
- // | }
+ // | require(["dojo/query", "dojo/_base/lang", "dojo/NodeList", "dojo/NodeList-dom"
+ // | ], function(query, lang){
+ // | lang.extend(NodeList, {
+ // | third: function(){
+ // | var newNodeList = NodeList(this[2]);
+ // | return newNodeList._stash(this);
+ // | }
+ // | });
+ // | // then see how _stash applies a sub-list, to be .end()'ed out of
+ // | query(".foo")
+ // | .third()
+ // | .addClass("thirdFoo")
+ // | .end()
+ // | // access to the orig .foo list
+ // | .removeClass("foo")
// | });
- // | // then see how _stash applies a sub-list, to be .end()'ed out of
- // | dojo.query(".foo")
- // | .third()
- // | .addClass("thirdFoo")
- // | .end()
- // | // access to the orig .foo list
- // | .removeClass("foo")
- // |
//
this._parent = parent;
return this; // dojo/NodeList
@@ -272,13 +258,18 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
on: function(eventName, listener){
// summary:
// Listen for events on the nodes in the NodeList. Basic usage is:
- // | query(".my-class").on("click", listener);
- // This supports event delegation by using selectors as the first argument with the event names as
- // pseudo selectors. For example:
- // | dojo.query("#my-list").on("li:click", listener);
- // This will listen for click events within `<li>` elements that are inside the `#my-list` element.
- // Because on supports CSS selector syntax, we can use comma-delimited events as well:
- // | dojo.query("#my-list").on("li button:mouseover, li:click", listener);
+ //
+ // example:
+ // | require(["dojo/query"
+ // | ], function(query){
+ // | query(".my-class").on("click", listener);
+ // This supports event delegation by using selectors as the first argument with the event names as
+ // pseudo selectors. For example:
+ // | query("#my-list").on("li:click", listener);
+ // This will listen for click events within `<li>` elements that are inside the `#my-list` element.
+ // Because on supports CSS selector syntax, we can use comma-delimited events as well:
+ // | query("#my-list").on("li button:mouseover, li:click", listener);
+ // | });
var handles = this.map(function(node){
return on(node, eventName, listener); // TODO: apply to the NodeList so the same selector engine is used for matches
});
@@ -298,13 +289,16 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// Returns the `NodeList` that generated the current `NodeList`. If there
// is no parent NodeList, an empty NodeList is returned.
// example:
- // | dojo.query("a")
- // | .filter(".disabled")
- // | // operate on the anchors that only have a disabled class
- // | .style("color", "grey")
- // | .end()
- // | // jump back to the list of anchors
- // | .style(...)
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("a")
+ // | .filter(".disabled")
+ // | // operate on the anchors that only have a disabled class
+ // | .style("color", "grey")
+ // | .end()
+ // | // jump back to the list of anchors
+ // | .style(...)
+ // | });
//
if(this._parent){
return this._parent;
@@ -331,7 +325,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// Returns a new NodeList, maintaining this one in place
// description:
// This method behaves exactly like the Array.slice method
- // with the caveat that it returns a dojo/NodeList and not a
+ // with the caveat that it returns a `dojo/NodeList` and not a
// raw Array. For more details, see Mozilla's [slice
// documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/slice)
// begin: Integer
@@ -353,7 +347,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// at an offset, optionally deleting elements
// description:
// This method behaves exactly like the Array.splice method
- // with the caveat that it returns a dojo/NodeList and not a
+ // with the caveat that it returns a `dojo/NodeList` and not a
// raw Array. For more details, see Mozilla's [splice
// documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice)
// For backwards compatibility, calling .end() on the spliced NodeList
@@ -375,7 +369,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
indexOf: function(value, fromIndex){
// summary:
- // see dojo.indexOf(). The primary difference is that the acted-on
+ // see `dojo/_base/array.indexOf()`. The primary difference is that the acted-on
// array is implicitly this NodeList
// value: Object
// The value to search for.
@@ -392,7 +386,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
lastIndexOf: function(value, fromIndex){
// summary:
- // see dojo.lastIndexOf(). The primary difference is that the
+ // see `dojo/_base/array.lastIndexOf()`. The primary difference is that the
// acted-on array is implicitly this NodeList
// description:
// For more details on the behavior of lastIndexOf, see
@@ -409,10 +403,10 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
every: function(callback, thisObject){
// summary:
- // see `dojo.every()` and the [Array.every
+ // see `dojo/_base/array.every()` and the [Array.every
// docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every).
// Takes the same structure of arguments and returns as
- // dojo.every() with the caveat that the passed array is
+ // dojo/_base/array.every() with the caveat that the passed array is
// implicitly this NodeList
// callback: Function
// the callback
@@ -424,8 +418,8 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
some: function(callback, thisObject){
// summary:
// Takes the same structure of arguments and returns as
- // `dojo.some()` with the caveat that the passed array is
- // implicitly this NodeList. See `dojo.some()` and Mozilla's
+ // `dojo/_base/array.some()` with the caveat that the passed array is
+ // implicitly this NodeList. See `dojo/_base/array.some()` and Mozilla's
// [Array.some
// documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some).
// callback: Function
@@ -468,7 +462,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
map: function(/*Function*/ func, /*Function?*/ obj){
// summary:
- // see dojo.map(). The primary difference is that the acted-on
+ // see `dojo/_base/array.map()`. The primary difference is that the acted-on
// array is implicitly this NodeList and the return is a
// NodeList (a subclass of Array)
return this._wrap(array.map(this, func, obj), this); // dojo/NodeList
@@ -476,7 +470,7 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
forEach: function(callback, thisObj){
// summary:
- // see `dojo.forEach()`. The primary difference is that the acted-on
+ // see `dojo/_base/array.forEach()`. The primary difference is that the acted-on
// array is implicitly this NodeList. If you want the option to break out
// of the forEach loop, use every() or some() instead.
forEach(this, callback, thisObj);
@@ -486,20 +480,26 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
filter: function(/*String|Function*/ filter){
// summary:
// "masks" the built-in javascript filter() method (supported
- // in Dojo via `dojo.filter`) to support passing a simple
+ // in Dojo via `dojo/_base/array.filter`) to support passing a simple
// string filter in addition to supporting filtering function
// objects.
// filter:
// If a string, a CSS rule like ".thinger" or "div > span".
// example:
- // "regular" JS filter syntax as exposed in dojo.filter:
- // | dojo.query("*").filter(function(item){
- // | // highlight every paragraph
- // | return (item.nodeName == "p");
- // | }).style("backgroundColor", "yellow");
+ // "regular" JS filter syntax as exposed in `dojo/_base/array.filter`:
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("*").filter(function(item){
+ // | // highlight every paragraph
+ // | return (item.nodeName == "p");
+ // | }).style("backgroundColor", "yellow");
+ // | });
// example:
// the same filtering using a CSS selector
- // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
+ // | require(["dojo/query", "dojo/NodeList-dom"
+ // | ], function(query){
+ // | query("*").filter("p").styles("backgroundColor", "yellow");
+ // | });
var a = arguments, items = this, start = 0;
if(typeof filter == "string"){ // inline'd type check
@@ -539,18 +539,27 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
//
// example:
// Shorten the list to the first, second, and third elements
- // | query("a").at(0, 1, 2).forEach(fn);
+ // | require(["dojo/query"
+ // | ], function(query){
+ // | query("a").at(0, 1, 2).forEach(fn);
+ // | });
//
// example:
// Retrieve the first and last elements of a unordered list:
- // | query("ul > li").at(0, -1).forEach(cb);
+ // | require(["dojo/query"
+ // | ], function(query){
+ // | query("ul > li").at(0, -1).forEach(cb);
+ // | });
//
// example:
// Do something for the first element only, but end() out back to
// the original list and continue chaining:
- // | query("a").at(0).onclick(fn).end().forEach(function(n){
- // | console.log(n); // all anchors on the page.
+ // | require(["dojo/query"
+ // | ], function(query){
+ // | query("a").at(0).onclick(fn).end().forEach(function(n){
+ // | console.log(n); // all anchors on the page.
// | })
+ // | });
var t = new this._NodeListCtor(0);
forEach(arguments, function(i){
@@ -617,22 +626,20 @@ define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/la
// example:
// add an onclick handler to every submit button in the document
// which causes the form to be sent via Ajax instead:
- // | require(["dojo/query"], function(query){
+ // | require(["dojo/query", "dojo/request", "dojo/dom-form", "dojo/dom-construct", "dojo/dom-style"
+ // | ], function(query, request, domForm, domConstruct, domStyle){
// | query("input[type='submit']").on("click", function(e){
- // | dojo.stopEvent(e); // prevent sending the form
+ // | e.preventDefault(); // prevent sending the form
// | var btn = e.target;
- // | dojo.xhrPost({
- // | form: btn.form,
- // | load: function(data){
- // | // replace the form with the response
- // | var div = dojo.doc.createElement("div");
- // | dojo.place(div, btn.form, "after");
- // | div.innerHTML = data;
- // | dojo.style(btn.form, "display", "none");
- // | }
+ // | request.post("http://example.com/", {
+ // | data: domForm.toObject(btn.form)
+ // | }).then(function(response){
+ // | // replace the form with the response
+ // | domConstruct.create(div, {innerHTML: response}, btn.form, "after");
+ // | domStyle.set(btn.form, "display", "none");
// | });
// | });
- // | });
+ // | });
//
// description:
// dojo/query is responsible for loading the appropriate query engine and wrapping
diff --git a/string.js b/string.js
index 7784a78..5af2556 100644
--- a/string.js
+++ b/string.js
@@ -152,7 +152,7 @@ string.trim = String.prototype.trim ?
// Returns the trimmed string
// description:
// This version of trim() was taken from [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript).
- // The short yet performant version of this function is dojo.trim(),
+ // The short yet performant version of this function is dojo/_base/lang.trim(),
// which is part of Dojo base. Uses String.prototype.trim instead, if available.
return ""; // String
};
diff --git a/text.js b/text.js
index 752b3d2..e7714de 100644
--- a/text.js
+++ b/text.js
@@ -79,6 +79,7 @@ define(["./_base/kernel", "require", "./has", "./has!host-browser?./request"], f
// "dojo.cache" style of call):
// | //If template.html contains "<h1>Hello</h1>" that will be
// | //the value for the text variable.
+ // | //Note: This is pre-AMD, deprecated syntax
// | var text = dojo["cache"]("my.module", "template.html");
// example:
// To ask dojo.cache to fetch content and store it in the cache, and sanitize the input
@@ -87,12 +88,14 @@ define(["./_base/kernel", "require", "./has", "./has!host-browser?./request"], f
// dojo.cache calls, use the "dojo.cache" style of call):
// | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
// | //text variable will contain just "<h1>Hello</h1>".
+ // | //Note: This is pre-AMD, deprecated syntax
// | var text = dojo["cache"]("my.module", "template.html", {sanitize: true});
// example:
// Same example as previous, but demonstrates how an object can be passed in as
// the first argument, then the value argument can then be the second argument.
// | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
// | //text variable will contain just "<h1>Hello</h1>".
+ // | //Note: This is pre-AMD, deprecated syntax
// | var text = dojo["cache"](new dojo._Url("my/module/template.html"), {sanitize: true});
// * (string string [value]) => (module, url, value)
diff --git a/touch.js b/touch.js
index 6b53bd7..f0dd154 100644
--- a/touch.js
+++ b/touch.js
@@ -266,7 +266,7 @@ function(dojo, aspect, dom, domClass, lang, on, has, mouse, domReady, win){
// was called in a touch.press event listener.
//
// example:
- // Used with dojo.on
+ // Used with dojo/on
// | define(["dojo/on", "dojo/touch"], function(on, touch){
// | on(node, touch.press, function(e){});
// | on(node, touch.move, function(e){});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list