Use attribute binding for data-... attributes

See: https://polymer-library.polymer-project.org/2.0/docs/devguide/data-binding#native-binding
Change-Id: Ia0791729705cf8a02b3fbbb98961c274e80dedf9
This commit is contained in:
Dmitrii Filippov
2019-11-12 10:50:39 +01:00
committed by David Pursehouse
parent 0998cfad1a
commit 049cc0bc09
4 changed files with 8 additions and 8 deletions

View File

@@ -73,7 +73,7 @@ limitations under the License.
<gr-button
link
disabled$="[[disabled]]"
data-item="[[item]]"
data-item$="[[item]]"
on-click="_handleDelete">Delete</gr-button>
</div>
</template>

View File

@@ -67,7 +67,7 @@
},
_handleDelete(e) {
const value = Polymer.dom(e).localTarget.dataItem;
const value = Polymer.dom(e).localTarget.dataset.item;
this._dispatchChanged(
this.pluginOption.info.values.filter(str => str !== value));
},

View File

@@ -61,21 +61,21 @@ limitations under the License.
<td class="buttonColumn">
<gr-button
link
data-index="[[index]]"
data-index$="[[index]]"
on-click="_handleMoveUpButton"
class="moveUpButton"></gr-button>
</td>
<td class="buttonColumn">
<gr-button
link
data-index="[[index]]"
data-index$="[[index]]"
on-click="_handleMoveDownButton"
class="moveDownButton"></gr-button>
</td>
<td>
<gr-button
link
data-index="[[index]]"
data-index$="[[index]]"
on-click="_handleDeleteButton"
class="remove-button">Delete</gr-button>
</td>

View File

@@ -27,7 +27,7 @@
},
_handleMoveUpButton(e) {
const index = Polymer.dom(e).localTarget.dataIndex;
const index = Number(Polymer.dom(e).localTarget.dataset.index);
if (index === 0) { return; }
const row = this.menuItems[index];
const prev = this.menuItems[index - 1];
@@ -35,7 +35,7 @@
},
_handleMoveDownButton(e) {
const index = Polymer.dom(e).localTarget.dataIndex;
const index = Number(Polymer.dom(e).localTarget.dataset.index);
if (index === this.menuItems.length - 1) { return; }
const row = this.menuItems[index];
const next = this.menuItems[index + 1];
@@ -43,7 +43,7 @@
},
_handleDeleteButton(e) {
const index = Polymer.dom(e).localTarget.dataIndex;
const index = Number(Polymer.dom(e).localTarget.dataset.index);
this.splice('menuItems', index, 1);
},