Skip to content

Commit

Permalink
Fixing some typos in comments, elaborating more in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed Dec 16, 2013
1 parent a3a530c commit e5b3039
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions Docs/Delegator.md
Expand Up @@ -74,7 +74,7 @@ If you're using [Behavior](Behavior.md) you should connect the two so that links

### Conditionals

Delegator also allows any trigger's options to include conditoinals that will prevent the trigger from being invoked if they match. These conditionals are run at event time, allowing you to program your UI for different states.
Delegator also allows any trigger's options to include conditionals that will prevent or allow the trigger from being invoked if they match. These conditionals are run at event time, allowing you to program your UI for different states. Delegator provides two conditionals - `if` and `unless`. In theory this could be extended to include others like less than or greater than at some point.

#### Examples

Expand Down Expand Up @@ -166,7 +166,7 @@ Here we have 3 different Delegator triggers we are invoking when the user clicks

Finally, Delegator offers a special trigger called a `switch`. These allow you to define multiple sets of triggers to execute when a condition is met. If the user clicks this button and some radio button is selected, execute these triggers on THAT group of elements, else execute these OTHER triggers on these OTHER elements.

There are two types of switches: `first` and `any`. The `first` switch iterates over your switch groups and executes the first group whose condition is `true`, while the `any` switch iterates over all the trigger groups, executing any whose condition is true. As with all triggers, a group with no condition is treated as one that is `true` and executed.
There are two types of switches: `first` and `any`. The `first` switch iterates over your switch groups (in the order they are declared) and executes the first group whose condition is `true`, while the `any` switch iterates over all the trigger groups, executing any whose condition is true. As with all triggers, a group with no condition is treated as one that is `true` and executed.

#### Examples

Expand All @@ -176,20 +176,20 @@ There are two types of switches: `first` and `any`. The `first` switch iterates
'div.foo::hasClass':['baz']
},
triggers: [
'.foo::switch1'
'.foo::trigger1'
]
},
{
'unless': {
'div.foo::hasClass':['baz']
},
triggers: [
'.foo::switch2'
'.foo::trigger2'
]
},
{
triggers: [
'.foo::switch3'
'.foo::trigger3'
]
}
]">...</a>
Expand All @@ -202,20 +202,20 @@ In the above example, Delegator iterates over the array of trigger groups define
'div.foo::hasClass':['baz']
},
triggers: [
'.foo::switch1'
'.foo::trigger1'
]
},
{
'unless': {
'div.foo::hasClass':['baz']
},
triggers: [
'.foo::switch2'
'.foo::trigger2'
]
},
{
triggers: [
'.foo::switch3'
'.foo::trigger3'
]
}
]">...</a>
Expand All @@ -233,12 +233,12 @@ Note that, as with any trigger, you can have a conditional for the switch itself
'div.foo::hasClass':['baz']
},
triggers: [
'.foo::switch1'
'.foo::trigger1'
]
},
{
triggers: [
'.foo::switch3'
'.foo::trigger3'
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions Source/Behavior.js
Expand Up @@ -501,8 +501,8 @@ provides: [Behavior]

/*
private method
give an element and a selector, fetches elements relative to
that element. boolean 'multi' determins if its getElement or getElements
given an element and a selector, fetches elements relative to
that element. boolean 'multi' determines if its getElement or getElements
special cases for when the selector == 'window' (returns the window)
and selector == 'self' (returns the element)
- for both of those, if multi is true returns
Expand Down
4 changes: 2 additions & 2 deletions Source/Delegator.js
Expand Up @@ -272,7 +272,7 @@ provides: [Delegator]
_eventHandler: function(event, target){
// get the triggers from the target element
var triggers = target.getTriggers();
// if the trigger is of the special types handles by delegator itself,
// if the trigger is of the special types handled by delegator itself,
// run those and remove them from the list of triggers
if (triggers.contains('Stop')) triggers.erase('Stop') && event.stop();
if (triggers.contains('PreventDefault')) triggers.erase('PreventDefault') && event.preventDefault();
Expand All @@ -297,7 +297,7 @@ provides: [Delegator]

// get the triggers (required)
var triggers = api.getAs(Array, 'triggers');
// if they're there and there are any, run them
// if there are triggers, run them
if (triggers && triggers.length) this._runMultipleTriggers(element, event, triggers);
},

Expand Down

0 comments on commit e5b3039

Please sign in to comment.