Skip to content

binding to a builtin name fails cryptically #510

Description

@dagitses

Example:
<template repeat="{{dir in [1, 2, 3]}}">{{dir}}</template> => 333

I scratched my head on this one for a very long time before I realized that dir() is some kind of special value, at least in Chrome.

Apologies for the imprecision, I don't know the status of "dir" in Javascript, i.e. is it just in Chrome, is it a builtin? Nevertheless, it exhibits this really unfortunate behavior.

Is is possible to detect such uses, or to make them work as intended?

http://jsbin.com/polojite/1/edit

Activity

  1. ebidel commented on May 20, 2014

    @ebidel
    Contributor

    Sorry, that's definitely a head scratcher. We should probably throw a warning for cases like this.

    I believe it's part of the Console API (console.dir): https://developer.chrome.com/devtools/docs/console-api#consoledirobject

  2. sjmiles commented on May 20, 2014

    @sjmiles
    Contributor

    'dir' specifies directionality ('rtl' or 'auto') for HTMLElement:
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.dir

    On Tue, May 20, 2014 at 9:17 AM, Eric Bidelman notifications@github.comwrote:

    Sorry, that's definitely a head scratcher. We should probably throw a
    warning for cases like this.

    I believe it's part of the Console API (console.dir):
    https://developer.chrome.com/devtools/docs/console-api#consoledirobject

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/510#issuecomment-43647828
    .

  3. ebidel commented on May 20, 2014

    @ebidel
    Contributor

    Ah yes. Related: #123

  4. dagitses commented on May 20, 2014

    @dagitses
    Author

    Edit: removed. I may be wrong.

  5. dagitses commented on May 20, 2014

    @dagitses
    Author

    Removed previous comment, I probably misdiagnosed the issue.

  6. sjmiles commented on May 20, 2014

    @sjmiles
    Contributor

    This sounds like #123, but it's not. This variable dir should be distinct from any prototype, I believe this is a bug in TemplateBinding. I'm working on a reduction and an issue ticket.

  7. sjmiles commented on May 20, 2014

    @sjmiles
    Contributor

    Not TemplateBinding, rather polymer-expressions.

  8. ebidel commented on May 20, 2014

    @ebidel
    Contributor

    Thanks @sjmiles.

  9. sjmiles commented on May 20, 2014

    @sjmiles
    Contributor
  10. dagitses commented on May 20, 2014

    @dagitses
    Author

    Thanks for the quick triage.

  11. sorvell commented on Aug 12, 2014

    @sorvell
    Contributor

    Closing since the root cause (googlearchive/polymer-expressions#33) has been fixed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions