Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Missing e in function - Tutorial #875

Closed
ebidel opened this issue Jan 20, 2015 · 5 comments
Closed

Missing e in function - Tutorial #875

ebidel opened this issue Jan 20, 2015 · 5 comments
Assignees

Comments

@ebidel
Copy link
Contributor

ebidel commented Jan 20, 2015

From @voxic on January 20, 2015 11:50

Hi

Noticed that there is an error in the code in the tutorial instructions.

https://www.polymer-project.org/docs/start/tutorial/step-1.html

The last code box:

<script>
  var tabs = document.querySelector('paper-tabs');
  tabs.addEventListener('core-select', function() {
    console.log("Selected: " + tabs.selected);
  });
</script>
</body>

Should be:

<script>
    var tabs = document.querySelector('paper-tabs');
    tabs.addEventListener('core-select', function(e) {
      console.log("Selected: " + tabs.selected);
    });
</script>
</body>

/Emil

Copied from original issue: Polymer/polymer#1110

@ebidel
Copy link
Contributor Author

ebidel commented Jan 20, 2015

This isn't critical because the event isn't being used in the callback. I'll leave to @arthurevans to decide if we should add it.

@ssorallen
Copy link

A linter like JSHint would warn that the e variable is declared but never used. Minifying with something like Uglify would remove the e. I lean toward leaving it out entirely, but either way works.

@voxic
Copy link

voxic commented Jan 20, 2015

Well, if you look at the attached support file, witch should contain the "correct" solution, it has the e witch can be confusing if you are totally new to JavaScript.

ref: https://github.com/Polymer/polymer-tutorial/blob/master/step-1/index.html

/Emil

@arthurevans
Copy link

Hi Emil,

You're right, those two should match. In this case, I think the solution file is wrong -- the subsequent steps and the finished version all omit the e. Sorry for the confusion -- I'll fix that.

arthurevans pushed a commit to googlearchive/polymer-tutorial that referenced this issue Jan 20, 2015
Related to Polymer/old-docs-site/issues/875.
Argument isn't used, and is omitted from all the other versions (step-2, step-3, and finished).
@arthurevans
Copy link

Updated the polymer-tutorial repo to match the docs. Thanks for the heads-up, @voxic!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants