Skip to content

Loading…

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

Closed
urandom opened this Issue · 5 comments

4 participants

@urandom

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
Owner

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

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

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

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 added p1 and removed pending-response labels
@sorvell sorvell self-assigned this
@sorvell
Owner

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

@sorvell sorvell added p0 and removed p1 labels
@sorvell sorvell closed this in ee61627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.