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

polymer-element with noscript behaves wrongly compared to Polymer.js #17426

Closed
danellis opened this issue Mar 12, 2014 · 10 comments
Closed

polymer-element with noscript behaves wrongly compared to Polymer.js #17426

danellis opened this issue Mar 12, 2014 · 10 comments
Labels
area-pkg closed-obsolete Closed as the reported issue is no longer relevant

Comments

@danellis
Copy link

What steps will reproduce the problem?

<polymer-element name="test-element" attributes="word" lightdom noscript>
    <template>Foo {{word}} <content></content></template>
</polymer-element>

<test-element word="bar">baz</test-element>

What is the expected output? What do you see instead?

Expected: "Foo bar baz"
Result with lightdom: "bazFoo"
Result without lightdom: "Foo baz"

What version of the product are you using? On what operating system?

0.9.5 of Polymer.dart

Please provide any additional information below.

JS Fiddle for the JS version: http://jsfiddle.net/vV3yS/

@kasperl
Copy link

kasperl commented Mar 12, 2014

Added Area-Polymer, Triaged labels.

@sigmundch
Copy link
Member

I guess there are 2 issues in this bug.

(a) attributes without corresponding fields are not supported (that's why 'bar' doesn't show up)

This is actually by design. Unlike Javascript, in Dart we can't add fields to classes unless they are declared. So if you want to have an attribute "word" in the custom element, you don't support doing that with noscript. You need to declare a class with a field called word and mark it with @­published.

The good news is that in polymer 0.10.0 this will be "fixed" in a way. It will no longer be a problem because 'noscript' elements will be implemented entirely using polymer.js (you can actually test it out if you are curious by depending on the pre-release version 0.10.0-pre.2).

(b) lightdom seems broken (shows as bazFoo instead of Foo baz)

This is a bit more tricky and we'd have to take a look. My understanding though is that lightdom is not a well supported feature in polymer.js either and it might be going away in the near future.

@DartBot
Copy link

DartBot commented Mar 12, 2014

This comment was originally written by @zoechi


Polymer/old-docs-site#243 (Remove lightdom attribute - fixed)

@danellis
Copy link
Author

This is actually by design. Unlike Javascript, in Dart we can't add fields to classes unless they are declared.

In the noscript case, though, there is no class no not be able to add fields to. Could you back the template binding with a map in that case, or is that too much special-casing? Having a class and no noscript will work fine in my case; I was just trying to avoid creating a lot of classes that had no purpose other than to liven an element that just formats a message.

in polymer 0.10.0 ... 'noscript' elements will be implemented entirely using polymer.js

So when running in Dartium, both Polymer.dart and Polymer.js will be loaded in the same application? (I feel like I'm missing something there.)

@sigmundch
Copy link
Member

Polymer/old-docs-site#243 (Remove lightdom attribute - fixed)

Ah, I guess it's gone :). Seems that we don't have any action items for (b) then.

So when running in Dartium, both Polymer.dart and Polymer.js will be loaded in the same application? (I feel like I'm missing something there.)

Yes, exactly. We use js-interop to get them running together. Part of the challenge was that the <polymer-element> declaration was shared by both JS and Dart, but browsers only allow one owner for a registered element. So, one change we did was to let <polymer-element> be owned by polymer.js and use js-interop to call into Dart and register definitions that have a Dart class behind it.

It might be that we discover this is too heavy and we really want to bring back noscript into the Dart implementation. If we do so, I think your idea of backing up the element with a map would be worth exploring.

@danellis
Copy link
Author

Thanks. 0.10.0 gets me working apart from styles. Without lightdom, I'm not sure how to allow for a stylesheet that styles the internals of my custom elements. Neither ^ nor /shadow/ seem to work in Dartium. Is either supported by it, and are there polyfills?

@DartBot
Copy link

DartBot commented Mar 13, 2014

This comment was originally written by @zoechi


The ^ and ^^ work fine for me in Dartium since a few weeks.
Can you please create a question on StackOverflow about the selectors, if possible with some HTML/CSS to show what you try to accomplish.

@jmesserly
Copy link

Removed Area-Polymer label.
Added Pkg-Polymer, Area-Pkg labels.

@sigmundch
Copy link
Member

Closing this issue.

Regarding style: the notation changed again since we last posted here, you can find several examples where people got it working using /deep/.


Added AssumedStale label.

@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/polymer-dart#130.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

6 participants