How do I get the width of a custom element from the element's script?
<polymer-element name="his-elem">
<div>
blah
</div>
</polymer-element>
@CustomTag('his-elem')
class blah extends PolymerElement {
@override
void attached() {
// how do I get the <his-elem>'s width (just width, no padding border stuff) here?
// document.querySelector('his-elem').getComputedStyle().width gives me "auto"...
}
}
Update
Add :host {display: block;}
to his-element, then you can get the actual width via <his-elem>.clientWidth
.