1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
dojo._xdResourceLoaded(function(dojo, dijit, dojox){
return {depends: [["provide", "dojox.form.manager._ClassMixin"],
["require", "dojox.form.manager._Mixin"]],
defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.form.manager._ClassMixin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.form.manager._ClassMixin"] = true;
dojo.provide("dojox.form.manager._ClassMixin");
dojo.require("dojox.form.manager._Mixin");
(function(){
var fm = dojox.form.manager,
aa = fm.actionAdapter,
ia = fm.inspectorAdapter;
dojo.declare("dojox.form.manager._ClassMixin", null, {
// summary:
// Form manager's mixin for testing/assigning/removing
// classes of controlled elements.
// description:
// This mixin provides unified way to check/add/remove a class
// of controlled elements.
// It should be used together with dojox.form.manager.Mixin.
gatherClassState: function(className, names){
// summary:
// Gather the presence of a certain class in all controlled elements.
// className: String:
// The class name to test for.
// names: Object?:
// If it is an array, it is a list of names to be processed.
// If it is an object, dictionary keys are names to be processed.
// If it is omitted, all known form elements are to be processed.
var result = this.inspect(ia(function(name, node){
return dojo.hasClass(node, className);
}), names);
return result; // Object
},
addClass: function(className, names){
// summary:
// Add a class to nodes according to the supplied set of names
// className: String:
// Class name to add.
// names: Object?:
// If it is an array, it is a list of names to be processed.
// If it is an object, dictionary keys are names to be processed.
// If it is omitted, all known form elements are to be processed.
this.inspect(aa(function(name, node){
dojo.addClass(node, className);
}), names);
return this; // self
},
removeClass: function(className, names){
// summary:
// Remove a class from nodes according to the supplied set of names
// className: String:
// Class name to remove.
// names: Object?:
// If it is an array, it is a list of names to be processed.
// If it is an object, dictionary keys are names to be processed.
// If it is omitted, all known form elements are to be processed.
this.inspect(aa(function(name, node){
dojo.removeClass(node, className);
}), names);
return this; // self
}
});
})();
}
}};});
|