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

DOM Api fails to select an element in a dom-repeat in polymer 1.1 #2276

Closed
urandom opened this issue Aug 14, 2015 · 8 comments
Closed

DOM Api fails to select an element in a dom-repeat in polymer 1.1 #2276

urandom opened this issue Aug 14, 2015 · 8 comments
Assignees
Labels

Comments

@urandom
Copy link

urandom commented Aug 14, 2015

Doing something like:

Polymer.dom(this.root).querySelectorAll('some-element')

worked pretty well in polymer 1.0. Both elements in in the local dom as well as results from dom-repeat templates are selected. With polymer 1.1, the elements produced with dom-repeat are not selectable anymore.

@sorvell
Copy link
Contributor

sorvell commented Aug 15, 2015

I'm not able to confirm this issue. Here's a jsbin that confirms it's working (press the Test button and see the console output):

http://jsbin.com/hizevocota/edit?html,console,output

Would you mind providing more info about when you're calling this method?

@urandom
Copy link
Author

urandom commented Aug 15, 2015

I'm calling this method from an on-tap handler, though the later doesn't really matter. Calling Polymer.dom(ELEMENT.root).querySelectorAll('*') doesn't contain the expected elements.

The elements which never appear in these queries are all from within a dom-repeat template, located here:
https://github.com/urandom/readeef/blob/7f13bc0769d5477e26ceaabfaa0b46f9620ace31/templates/components/rf-feed-base.tmpl#L106

When I try to fetch a particular element from within, the result is always undefined:
https://github.com/urandom/readeef/blob/7f13bc0769d5477e26ceaabfaa0b46f9620ace31/templates/components/rf-feed-base.tmpl#L259

The component which holds all of that html as its content is here:
https://github.com/urandom/readeef/blob/7f13bc0769d5477e26ceaabfaa0b46f9620ace31/templates/components/rf-app-scaffold.tmpl

@b-strauss
Copy link

Hello, i have the same problem. A working demo with the bug can be found here:

http://jsbin.com/razotukane/1/edit?html,console,output

When you open the drawer and click on an item the console output should be 4 (the number of items). Instead it is 0. The function that can't find the elements is called from a tap event on one of the items that get rendered by the dom-repeat.

If you go to the head element and change the polymer.html to the 1.0.9 version (already in comments), everything works as it should. It also works if you change from shady to shadow dom.

@m4b
Copy link

m4b commented Aug 17, 2015

confirmed.

The mouseover highlighting stopped working in:

http://github.com/m4b/silicon-hex-table

when polymer was updated to 1.1.

Further investigation confirmed, as mentioned above, that Polymer.dom(this.root).querySelectorAll('.hex') was no longer returning the array of nodes with class hex at line 363. (it doesn't have to do with the this.async call either, as I've tested trying to get the hex nodes in an on-tap handler as well).

Pinning polymer to 1.0.9 returns the highlighting behavior as expected, and the nodes returned by querySelectorAll are as expected.

Note: the element generated was fairly complicated, perhaps this had something to do with it?

<template is="dom-repeat" items="[[_table]]" as="row">
        <tr>
          <td class="offsets">
            <span>[[_getOffset(offset, index)]]</span>
          </td>
          <td class="bytes">
            <template is="dom-repeat" items="[[_get(row)]]" as="col"><span id$="[[col.id]]" class="hex">[[_getHex(_bytes, offset, col)]]</span></template>
          </td>
          <td class="asciiheader">
            <template is="dom-repeat" items="[[_get(row)]]" as="col"><span id$="[[col.hid]]" class="ascii">[[_getAscii(_bytes, offset, col)]]</span></template>
          </td>
        </tr>
 </template>

@sorvell sorvell self-assigned this Aug 18, 2015
@sorvell
Copy link
Contributor

sorvell commented Aug 18, 2015

Ok, can confirm this problem now and it's definitely a regression. We're working on fixing it asap.

@AlexNasonov
Copy link

Still experience this problem with Polymer 1.6.1

@atishpatel
Copy link

atishpatel commented Nov 2, 2016

It works fine in Chrome, but this is still an issue for Safari 10.

Edit: Sorry. Nevermind. xD It was another issue.

@daniele-orlando
Copy link

Problem still persists with Polymer 1.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants