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

Trouble in latest Canary reading styles in attached handler of imported element #493

Closed
JanMiksovsky opened this issue May 7, 2014 · 5 comments

Comments

@JanMiksovsky
Copy link

Something recently broke in either Canary or Polymer/platform.js that changes what style information is available in an attached handler.

See http://jsbin.com/kaseye/5/edit. This jsbin defines an element whose attached handler reads some style information off an element in its shadow tree. The code works when run as is, and the console will report something like "2px" as the padding on the textarea.

However, if the definition for test-element is moved to a separate file and referenced via an import, the console will now report "0px" as the textarea padding. It seems that getComputedStyle returns a different value in the attached handler depending on whether the element is imported or not.

I have an element (http://component.kitchen/components/basic-autosize-textarea) that relies on this behavior. As the in-place demo on that page shows, the element works fine in production Chrome, but not in Canary (e.g., 36.0.1978.0).

(BTW, to help report bugs like these, I've tried various ways of having a jsbin import an element defined in another jsbin, but run into CORS issues. If anyone can offer guidance on how to do that, I'd be happy to create a parallel repro case that shows how importing the element from a separate file causes the code to break.)

@sorvell
Copy link
Contributor

sorvell commented May 7, 2014

I can confirm this. I'm going to investigate a bit and probably file a
blink bug. Thanks!

On Wed, May 7, 2014 at 9:49 AM, Jan Miksovsky [email protected]:

Something recently broke in either Canary or Polymer/platform.js that
changes what style information is available in an attached handler.

See http://jsbin.com/kaseye/5/edit. This jsbin defines an element whose
attached handler reads some style information off an element in its shadow
tree. The code works when run as is, and the console will report something
like "2px" as the padding on the textarea.

However, if the definition for test-element is moved to a separate file
and referenced via an import, the console will now report "0px" as the
textarea padding. It seems that getComputedStyle returns a different value
in the attached handler depending on whether the element is imported or not.

I have an element (
http://component.kitchen/components/basic-autosize-textarea) that relies
on this behavior. As the in-place demo on that page shows, the element
works fine in production Chrome, but not in Canary (e.g., 36.0.1978.0).

(BTW, to help report bugs like these, I've tried various ways of having a
jsbin import an element defined in another jsbin, but run into CORS issues.
If anyone can offer guidance on how to do that, I'd be happy to create a
parallel repro case that shows how importing the element from a separate
file causes the code to break.)


Reply to this email directly or view it on GitHubhttps://github.com//issues/493
.

@JanMiksovsky
Copy link
Author

@sorvell Gracias.

@sorvell
Copy link
Contributor

sorvell commented May 7, 2014

crbug.com/371026

On Wed, May 7, 2014 at 11:01 AM, Jan Miksovsky [email protected]:

@sorvell https://github.com/sorvell Gracias.


Reply to this email directly or view it on GitHubhttps://github.com//issues/493#issuecomment-42461163
.

@robdodson
Copy link
Contributor

@JanMiksovsky Here's an example of importing using CodePen. http://codepen.io/robdodson/pen/BpFAn

I've never tried with jsbin but I think someone did pull it off once on polymer-dev

@sorvell
Copy link
Contributor

sorvell commented Aug 12, 2014

@sorvell sorvell closed this as completed Aug 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants