Skip to content

Instantly share code, notes, and snippets.

@ChadKillingsworth
Forked from anonymous/index.html
Last active January 18, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChadKillingsworth/2bf35590c8bc01e22e97811410d4deb2 to your computer and use it in GitHub Desktop.
Save ChadKillingsworth/2bf35590c8bc01e22e97811410d4deb2 to your computer and use it in GitHub Desktop.
Polymer Colliding Property// source http://jsbin.com/suwupas
<!doctype html>
<head>
<meta charset="utf-8">
<title>Polymer Colliding Property</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.23/webcomponents-lite.min.js"></script>
<link href="https://raw.githubusercontent.com/Polymer/polymer/v1.7.1/polymer.html" rel="import">
</head>
<body>
<colliding-element></colliding-element>
<dom-module id="colliding-element">
<template>
<ul>
<template is="dom-repeat" items="[[list]]" as="colliding">
<li><button on-click="alert">[[colliding]]</button></li>
</template>
</ul>
</template>
</dom-module>
</body>
Polymer({
is: 'colliding-element',
properties: {},
ready() {
this.list = [1,2,3,4,5,6,7,8,9];
},
colliding(i) {
return this.list[i];
},
alert() {
try {
// this.colliding has been overwritten by
// the as="colliding" attribute on the
// dom-repeat
alert(this.colliding(0));
} catch (e) {
alert(e.message);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment