Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/Core/Mif.Tree.Draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Mif.Tree.Draw = {

getHTML: function(node,html){
var prefix = node.tree.DOMidPrefix;
if($defined(node.state.checked)){
if(node.state.checked != null){
if(!node.hasCheckbox) node.state.checked='nochecked';
var checkbox = '<span class="mif-tree-checkbox mif-tree-node-'+node.state.checked+'" uid="'+node.UID+'">'+Mif.Tree.Draw.zeroSpace+'</span>';
}else{
Expand Down Expand Up @@ -58,7 +58,7 @@ Mif.Tree.Draw = {
},

forestRoot: function(tree){
var container = new Element('div').addClass('mif-tree-children-root').injectInside(tree.wrapper);
var container = new Element('div').addClass('mif-tree-children-root').inject(tree.wrapper, 'inside');
Mif.Tree.Draw.children(tree.root, container);
},

Expand Down Expand Up @@ -118,5 +118,5 @@ Mif.Tree.Draw = {

};

Mif.Tree.Draw.zeroSpace = Browser.Engine.trident ? '&shy;' : (Browser.Engine.webkit ? '&#8203' : '');
Mif.Tree.Draw.zeroSpace = Browser.ie ? '&shy;' : ((Browser.chrome || Browser.safari) ? '&#8203' : '');

6 changes: 3 additions & 3 deletions Source/Core/Mif.Tree.Hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Mif.Tree.implement({
name: false,
node: false
};
this.hoverState = $unlink(this.defaultHoverState);
this.hoverState = Object.clone(this.defaultHoverState);
},

hover: function(){
var cnode = this.mouse.node;
var ctarget = this.mouse.target;
$each(this.hoverState, function(node, target, state){
Object.each(this.hoverState, function(node, target, state){
if(node == cnode && (target == 'node'||target==ctarget)) return;
if(node) {
Mif.Tree.Hover.out(node, target);
Expand All @@ -49,7 +49,7 @@ Mif.Tree.implement({
},

updateHover: function(){
this.hoverState = $unlink(this.defaultHoverState);
this.hoverState = Object.clone(this.defaultHoverState);
this.hover();
}

Expand Down
10 changes: 5 additions & 5 deletions Source/Core/Mif.Tree.Load.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Mif.Tree.implement({

load: function(options){
var tree = this;
this.loadOptions = this.loadOptions||$lambda({});
this.loadOptions = this.loadOptions||Function.from({});
function success(json){
if(tree.forest){
tree.root = new Mif.Tree.Node({
Expand All @@ -58,8 +58,8 @@ Mif.Tree.implement({
tree.fireEvent('load');
return tree;
}
options = $extend($extend({
isSuccess: $lambda(true),
options = Object.append(Object.append({
isSuccess: Function.from(true),
secure: true,
onSuccess: success,
method: 'get'
Expand Down Expand Up @@ -88,8 +88,8 @@ Mif.Tree.Node.implement({
self.tree.fireEvent('loadNode', self);
return self;
}
options=$extend($extend($extend({
isSuccess: $lambda(true),
options=Object.append(Object.append(Object.append({
isSuccess: Function.from(true),
secure: true,
onSuccess: success,
method: 'get'
Expand Down
16 changes: 8 additions & 8 deletions Source/Core/Mif.Tree.Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Mif.Tree.Node = new Class({
Implements: [Events],

initialize: function(structure, options) {
$extend(this, structure);
Object.append(this, structure);
this.children = [];
this.type = options.type || this.tree.dfltType;
this.property = options.property || {};
this.data = options.data;
this.state = $extend($unlink(this.tree.dfltState), options.state);
this.state = Object.append(Object.clone(this.tree.dfltState), options.state);
this.$calculate();
this.UID = Mif.Tree.Node.UID++;
Mif.Tree.Nodes[this.UID] = this;
Expand All @@ -33,13 +33,13 @@ Mif.Tree.Node = new Class({
},

$calculate: function(){
$extend(this, $unlink(this.tree.defaults));
this.type = $splat(this.type);
Object.append(this, Object.clone(this.tree.defaults));
this.type = Array.from(this.type);
this.type.each(function(type){
var props = this.tree.types[type];
if(props) $extend(this, props);
if(props) Object.append(this, props);
}, this);
$extend(this, this.property);
Object.append(this, this.property);
return this;
},

Expand Down Expand Up @@ -92,7 +92,7 @@ Mif.Tree.Node = new Class({
},

recursive: function(fn, args){
args=$splat(args);
args=Array.from(args);
if(fn.apply(this, args) !== false){
this.children.each(function(node){
if(node.recursive(fn, args) === false){
Expand Down Expand Up @@ -322,4 +322,4 @@ Mif.Tree.Node = new Class({
});

Mif.Tree.Node.UID = 0;
Mif.Tree.Nodes = {};
Mif.Tree.Nodes = {};
4 changes: 3 additions & 1 deletion Source/Core/Mif.Tree.Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Mif.Tree.implement({

initSelection: function(){
this.defaults.selectClass = '';
this.wrapper.addEvent('mousedown', this.attachSelect.bindWithEvent(this));
this.wrapper.addEvent('mousedown', function(event) {
this.attachSelect(event);
}.bind(this));
},

attachSelect: function(event){
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Mif.Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Mif.Tree = new Class({

version: '1.2.2',

Implements: [new Events, new Options],
Implements: [Events, Options],

options:{
types: {},
Expand All @@ -37,7 +37,7 @@ Mif.Tree = new Class({

initialize: function(options){
this.setOptions(options);
$extend(this, {
Object.append(this, {
types: this.options.types,
forest: this.options.forest,
animateScroll: this.options.animateScroll,
Expand All @@ -63,7 +63,7 @@ Mif.Tree = new Class({
this.updateOpenState();
if(this.options.expandTo) this.initExpandTo();
this.DOMidPrefix='mif-tree-';
this.wrapper = new Element('div').addClass('mif-tree-wrapper').injectInside(this.container);
this.wrapper = new Element('div').addClass('mif-tree-wrapper').inject(this.container, 'inside');
this.initEvents();
this.initScroll();
this.initSelection();
Expand Down