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

Safari & actions on native elements: Function statements must have a name. #11640

Closed
rlivsey opened this issue Jul 2, 2015 · 16 comments
Closed

Comments

@rlivsey
Copy link
Contributor

rlivsey commented Jul 2, 2015

TLDR: http://jsbin.com/xuquqa/edit?html,js,console,output

I've seen a few demos doing the rounds of how awesome the new actions helpers are in combination with native elements, eg:

  <select onchange={{action "selectChanged" value="target.value"}}>
    {{#each items as |item|}}
      <option>...</option>
    {{/each}}
  </select>

This works great in Chrome, but in Safari this results in an error when the event is triggered:

SyntaxError: Function statements must have a name. (line 1)

The JSBin has examples of input and select both of which raise the same error.

@rwjblue
Copy link
Member

rwjblue commented Jul 2, 2015

I believe that this is a duplicate, and that we are unlikely to fix (unless someone knows what the solution to this cryptic error is off hand), as we intend to submit another RFC for something that I have been calling 'kabab actions'. The idea is to enable per element / event handling like your example above, but still use our standard event dispatcher (this avoids adding a ton of event listeners).

@rlivsey
Copy link
Contributor Author

rlivsey commented Jul 2, 2015

Cool, I couldn't find a duplicate issue but must have missed it - I'll close this one.

I wasn't sure it was intended to be supported, seemed like a "happy" accident, but as I'd seen all the demos knocking about I thought I'd give it a go.

Makes sense to go through the dispatcher as opposed to going back to the 90's and attaching handlers all over the shop.

@rlivsey rlivsey closed this as completed Jul 2, 2015
@rwjblue
Copy link
Member

rwjblue commented Jul 2, 2015

No worries, I could be wrong about the dupe (SO MANY EMAILS 😺 ).

@stefanpenner
Copy link
Member

lets keep this open until a duplicate is linked.

@stefanpenner stefanpenner reopened this Jul 2, 2015
@stefanpenner
Copy link
Member

I believe this is a bug in Safari. Which results in our detection code being thrown off.

@rwjblue this is directly related to my email yesterday.

@stefanpenner
Copy link
Member

let me confirm

@cibernox
Copy link
Contributor

cibernox commented Jul 2, 2015

This could have been terrible news for me. Glad I haven't enabled a new feature.

@stefanpenner
Copy link
Member

yes this is related. I guess I need to role the fix sooner rather then later.

@raytiley
Copy link
Contributor

raytiley commented Jul 3, 2015

Duplicate is #11604 I believe, although that one is currently closed.

@stefanpenner
Copy link
Member

I have no idea why the other one is closed. The intent of HTMLBar's props first, attrs later approach is the highest possible fidelity with the underlying DOM or WebComponent nodes. This is obviously a loss in fidelity.

In addition, this is actually just illuminating the flawed existing behaviors, and results in some other serious issues...

––––

I am about 5 failing tests away from what appears like a much better solution.

@raytiley
Copy link
Contributor

raytiley commented Jul 3, 2015

I am about 5 failing tests away from what appears like a much better solution.

When are you not 5 failing tests away from a solution?

@stefanpenner
Copy link
Member

right now. 0 failing tests, now just waiting on other things....

@rlivsey
Copy link
Contributor Author

rlivsey commented Jul 3, 2015

@raytiley ah that's why I didn't find it, thanks!

@stefanpenner
Copy link
Member

i believe tildeio/htmlbars#374 should address this.

@rwjblue
Copy link
Member

rwjblue commented Jul 6, 2015

Fixed in 1.13.3.

@rwjblue rwjblue closed this as completed Jul 6, 2015
@stefanpenner
Copy link
Member

thanks for releasing :)

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

No branches or pull requests

5 participants