Add the concept of default options to `Y.Template`. #368

Merged
merged 3 commits into from Dec 20, 2012

Conversation

Projects
None yet
3 participants
@ericf
Member

ericf commented Dec 17, 2012

This adds a Y.Template(engine, defaults) signature so that common options can be specified as defaults and will be used when calling the instance methods, e.g., compile(), precompile(), render().

src/template/js/template-base.js
+
+ if (defaults) {
+ options = options ? Y.merge(defaults, options) : defaults;
+ }

This comment has been minimized.

@rgrove

rgrove Dec 17, 2012

Contributor

This could be simplified to a single line:

options = options ? Y.merge(this.defaults, options) : this.defaults;

Y.merge() ignores undefined arguments, so this ends up having the same behavior.

@rgrove

rgrove Dec 17, 2012

Contributor

This could be simplified to a single line:

options = options ? Y.merge(this.defaults, options) : this.defaults;

Y.merge() ignores undefined arguments, so this ends up having the same behavior.

This comment has been minimized.

@ericf

ericf Dec 17, 2012

Member

Good point.

@ericf

ericf Dec 17, 2012

Member

Good point.

@rgrove

This comment has been minimized.

Show comment
Hide comment
@rgrove

rgrove Dec 17, 2012

Contributor

👍

Contributor

rgrove commented Dec 17, 2012

👍

@davglass

This comment has been minimized.

Show comment
Hide comment
@davglass

davglass Dec 19, 2012

Member

👍

Member

davglass commented Dec 19, 2012

👍

@ericf ericf merged commit 1d3c09f into yui:dev-master Dec 20, 2012

1 check failed

default The Travis build failed
Details

@ericf ericf deleted the ericf:template-defaults branch Dec 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment