Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return value for Handlebars.noConflict(); #959

Closed
wants to merge 168 commits into from
Closed

Conversation

bernland
Copy link

As per our discussion #887, it would be great if the noConflict() method returned an instance of Handlebars.

The docs at http://handlebarsjs.com/reference.html (see paragraph Handlebars.noConflict()) already suggests it does.

g13013 and others added 25 commits January 30, 2014 16:19
fix global var  lookup error when undefined
Unravel mustache loop and hydrate function.

Also solidifying / making sense of helpers.

Example templates to give you an idea:

    {{foo}}<span></span>
    ...
    function template(context, options) {
      if (cachedFragment === null) {
        cachedFragment = build(dom);
      }
      var fragment = cachedFragment.cloneNode(true);
      var helpers = options && options.helpers || {};
      var placeholder0 = new Placeholder(fragment,0,1);
      helpers.CONTENT(placeholder0, "foo", context, [], {escaped:true}, helpers);
      return fragment;
    }

    <span>{{foo}}</span>{{foo}}
    ...
    function template(context, options) {
      if (cachedFragment === null) {
        cachedFragment = build(dom);
      }
      var fragment = cachedFragment.cloneNode(true);
      var helpers = options && options.helpers || {};
      var placeholder0 = new Placeholder(fragment.childNodes[0],-1,-1), placeholder1 = new Placeholder(fragment,0,1);
      helpers.CONTENT(placeholder0, "foo", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder1, "foo", context, [], {escaped:true}, helpers);
      return fragment;
    }

    {{foo}}<span>{{bar}}<a>{{baz}}<em>{{boo}}{{brew}}</em>{{bat}}</a></span>
    <span><span>{{flute}}</span></span>{{argh}}
    ...
    function template(context, options) {
      if (cachedFragment === null) {
        cachedFragment = build(dom);
      }
      var fragment = cachedFragment.cloneNode(true);
      var helpers = options && options.helpers || {};
      var placeholder0 = new Placeholder(fragment,0,1), parent0 = fragment.childNodes[1], placeholder1 = new Placeholder(parent0,-1,0), parent1 = parent0.childNodes[0], placeholder2 = new Placeholder(parent1,-1,0), parent2 = parent1.childNodes[0], placeholder3 = new Placeholder(parent2,-1,0), placeholder4 = new Placeholder(parent2,0,-1), placeholder5 = new Placeholder(parent1,0,-1), placeholder6 = new Placeholder(fragment.childNodes[2].childNodes[0],-1,-1), placeholder7 = new Placeholder(fragment,2,3);
      helpers.CONTENT(placeholder0, "foo", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder1, "bar", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder2, "baz", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder3, "boo", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder4, "brew", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder5, "bat", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder6, "flute", context, [], {escaped:true}, helpers);
      helpers.CONTENT(placeholder7, "argh", context, [], {escaped:true}, helpers);
      return fragment;
    }
Add passing test for compiling SVG elements
TODO: write tests for this
Fix typo in ARCHITECTURE.md
Conflicts:
	.gitignore
	.jshintrc
	.travis.yml
	Gruntfile.js
	LICENSE
	package.json
@kpdecker
Copy link
Collaborator

I think you selected the wrong branch when creating your pull request. Can you reopen against your own branch?

@kpdecker kpdecker closed this Feb 11, 2015
@bernland
Copy link
Author

This is really embarrassing: I forked your project into my account, then
tried to create a new pull request.

Error message: There isn't anything to compare wycats:master and
bernland:master are identical.

What am I missing here?

On 02/11/2015 06:30 AM, Kevin Decker wrote:

I think you selected the wrong branch when creating your pull request. Can you reopen against your own branch?


Reply to this email directly or view it on GitHub:
#959 (comment)

@kpdecker
Copy link
Collaborator

General flow that I use when submitting a PR from a fork:

git fetch upstream
git checkout upstream/master
git checkout -b $featureBranchName

You then make all of the changes that you need, push, and open the the PR. Upstream here is the remote for the source repo, for handlebars you'd need to set that up, something like:

git remote add upstream [email protected]:wycats/handlebars.js.git

@kpdecker kpdecker deleted the htmlbars-merge branch September 2, 2015 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.