alchaplinsky / polymer-rails

Polymer and web components for Ruby on Rails
MIT License
286 stars 80 forks source link

Form action attribute URL-escaping prevents data binding #75

Open Odaeus opened 8 years ago

Odaeus commented 8 years ago

Not sure if I'm doing this wrong but I have the following in a component HTML (written in Slim):

dom-module is="blah"
  template
    form action="{{url}}"
      input name="test" type="text"

This outputs:

<dom-module id="blah">
  <template>
    <form action="%5B%5Burl%5D%5D" method="get">
      <input type="text" name="test" />
    </form>
  </template>

Which means the action attribute cannot be bound due to URL escaping. Using data binding braces on other attributes works as normal, it's only affecting the form action attribute. I suspect this is caused by Nokogiri but I haven't been able to find the source of the problem.

Odaeus commented 8 years ago

I found a workaround (at least I assume it's not the recommended method) by using annotated attribute binding:

  form action$="{{url}}"
agnewtj commented 8 years ago

I found a similar problem with paper-icon-button - Nokogiri escaping "[[src]]". I posted a patch here: https://github.com/alchapone/polymer-elements-rails/issues/9

@alchapone - is there a better way to patch?