Polymer: :last-child selector broken inside dom-repeat

Created on 24 Sep 2015  路  7Comments  路  Source: Polymer/polymer

I can't get :last-child to work for the last element inside a dom-repeat...

the codepen
the gh gist

I think it's because the template itself becomes the last-child...
domrepeat

Most helpful comment

Or :last-of-type.

All 7 comments

You could just try :nth-last-child(2) instead of :last-child

Or :last-of-type.

Thanks for the workarounds. I was trying to turn off border-bottom on the last child... I swapped border-bottom for border-top and last-child for first-child.

Still seems like the last-child selector should work.

I'll close the issue if the polymer team doesn't consider it a bug. Perhaps it's in the docs somewhere?

:last-child won't work because the last child is the dom-repeat template.

+1 @miztroh, it shouldn't work this way, <template> is really last child, nothing wrong here.

Yes, :last-child refers to the element that is the last child of it's parent element, so <template is="dom-repeat"> would be the last child. https://developer.mozilla.org/en-US/docs/Web/CSS/%3Alast-child

You can user this:

.row:nth-last-child(2)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dandv picture dandv  路  4Comments

jimmc picture jimmc  路  3Comments

abdonrd picture abdonrd  路  4Comments

alexhx5 picture alexhx5  路  3Comments

nazar-pc picture nazar-pc  路  4Comments