Fix {{#dtdd}} handler in docs for 0.3.8 changes.

This commit is contained in:
David Glasser
2012-09-14 17:04:07 -07:00
parent 216b3f312e
commit 0ed8555690
2 changed files with 18 additions and 13 deletions

View File

@@ -1276,22 +1276,22 @@ The following properties and methods are available on the event object
passed to handlers: passed to handlers:
<dl class="objdesc"> <dl class="objdesc">
{{#dtdd "type" "String"}} {{#dtdd name="type" type="String"}}
The event's type, such as "click", "blur" or "keypress". The event's type, such as "click", "blur" or "keypress".
{{/dtdd}} {{/dtdd}}
{{#dtdd "target" "DOM Element"}} {{#dtdd name="target" type="DOM Element"}}
The element that originated the event. The element that originated the event.
{{/dtdd}} {{/dtdd}}
{{#dtdd "currentTarget" "DOM Element"}} {{#dtdd name="currentTarget" type="DOM Element"}}
The element currently handling the event. This is the element that The element currently handling the event. This is the element that
matched the selector in the event map. For events that bubble, it may matched the selector in the event map. For events that bubble, it may
be `target` or an ancestor of `target`, and its value changes as the be `target` or an ancestor of `target`, and its value changes as the
event bubbles. event bubbles.
{{/dtdd}} {{/dtdd}}
{{#dtdd "which" "Number"}} {{#dtdd name="which" type="Number"}}
For mouse events, the number of the mouse button (1=left, 2=middle, 3=right). For mouse events, the number of the mouse button (1=left, 2=middle, 3=right).
For key events, a character or key code. For key events, a character or key code.
{{/dtdd}} {{/dtdd}}

View File

@@ -277,16 +277,21 @@ Handlebars.registerHelper('note', function(fn) {
return Template.note_helper(fn(this)); return Template.note_helper(fn(this));
}); });
Handlebars.registerHelper('dtdd', function(name, optType, fn) { Handlebars.registerHelper('dtdd', function(nameOrOptions, maybeFn) {
var type = null; var name, type, fn;
// handle optional positional argument (messy) if (nameOrOptions.hash) {
if (! fn) // {{#dtdd name="foo" type="bar}}
fn = optType; // two arguments name = nameOrOptions.hash.name;
else type = nameOrOptions.hash.type;
type = optType; // three arguments fn = nameOrOptions.fn;
} else {
// {#dtdd name}}
name = nameOrOptions;
fn = maybeFn.fn;
// no type
}
return Template.dtdd_helper( return Template.dtdd_helper({descr: fn(this), name: name, type: type});
{descr: fn(this), name:name, type:type}, true);
}); });
Handlebars.registerHelper('better_markdown', function(fn) { Handlebars.registerHelper('better_markdown', function(fn) {