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:
<dl class="objdesc">
{{#dtdd "type" "String"}}
{{#dtdd name="type" type="String"}}
The event's type, such as "click", "blur" or "keypress".
{{/dtdd}}
{{#dtdd "target" "DOM Element"}}
{{#dtdd name="target" type="DOM Element"}}
The element that originated the event.
{{/dtdd}}
{{#dtdd "currentTarget" "DOM Element"}}
{{#dtdd name="currentTarget" type="DOM Element"}}
The element currently handling the event. This is the element that
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
event bubbles.
{{/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 key events, a character or key code.
{{/dtdd}}

View File

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