From c417c45e23f93466c40391f50a74550189493bdb Mon Sep 17 00:00:00 2001 From: Artem Khodyush Date: Wed, 8 Oct 2014 03:45:21 -0700 Subject: [PATCH] fix core-activate event detail: data and item are null when tapping element generated with template nested inside list item reported in https://groups.google.com/d/msg/polymer-dev/ngUkehsrnUc/DrvPNFibruIJ --- core-list.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core-list.html b/core-list.html index d97d05b..c133020 100644 --- a/core-list.html +++ b/core-list.html @@ -373,7 +373,14 @@ return; } - var model = n.templateInstance && n.templateInstance.model; + // in case the tap was on some nested template or element instance, + // find an instance generated with this particular element template + // using the fact that they all are siblings of this.template + while (n && n.parentNode !== this.template.parentNode) { + n = n.host ? n.host : n.parentNode; + } + + var model = n && n.templateInstance && n.templateInstance.model; if (model) { var vi = model.index, pi = model.physicalIndex; var data = this.data[vi], item = this._physicalItems[pi];