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

Input type="password" matching model.password with no mapping #65

Open
tauren opened this issue Apr 23, 2012 · 1 comment
Open

Input type="password" matching model.password with no mapping #65

tauren opened this issue Apr 23, 2012 · 1 comment

Comments

@tauren
Copy link
Contributor

tauren commented Apr 23, 2012

Given the following template:

<script type="text/x-plates-tmpl" id="testTmpl">
  <input type="text" id="x_username" placeholder="Enter username..."/>
  <br/>
  <input type="password" id="x_password" placeholder="Enter password..."/>
</script>
<div id="output"></div>

And the following code:

var user = {
  name: 'Sally Smith',
  username: 'sally',
  password: 'mypass'
};

var html = $('script#testTmpl').text();
var map = Plates.Map();
$('#output').html(Plates.bind(html, user, map));


This doesn't render properly. The value mypass is rendered after the input. The template should be rendered exactly as is without any variable replacements.

See in action here:
http://jsfiddle.net/tauren/HRDaD/

@osmestad
Copy link

osmestad commented Oct 1, 2012

The issue here seems to be that by default Plates tries to match the value of all attributes to the data keys (not just the ID as the documentation says).

Another example based on the simple usage case:

var P = require('plates');

var html = '<div id="test">Old Value</div><div data-attr="test">Old Value</div>';
var data = { "test": "New Value" };

var output = P.bind(html, data); 

Here the content of both divs are replaced.

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

2 participants