+Arthur

You should still use a .html file and a <link> to import it, but the demo
just leaves a <script> tag around the behavior definition.

And yes, the demo pollutes the global environment. Polymer does not
prescribe a module system, but you can use one, like AMD (via the html
import friendly IMD[1] package) if you like.

Cheers,
  Justin

[1]: https://github.com/PolymerLabs/IMD


On Thu, May 28, 2015 at 3:45 AM, NanoWANG <[email protected]> wrote:

> Additionally, the only problem is, it will pollute the global environment,
> if using <script> instead of <link>
>
>
> On Thursday, May 28, 2015 at 6:15:00 PM UTC+8, NanoWANG wrote:
>>
>> Hi all,
>>
>> So in 0.9 Mixins becomes Behaviors, but I can't even make the official
>> demo work.
>>
>> As said in the doc
>> <https://www.polymer-project.org/0.9/docs/devguide/behaviors.html>, I
>> should put the behavior object in a html file(which is weird since it'll
>> broke some build chains), and then do this:
>>
>> <link rel="import" href="highlight-behavior.html">
>>
>> But all I got is `HighlightBehavior not defined` when runinng the line
>>
>> behaviors: [HighlightBehavior]
>>
>> On the other hand, I renamed the extension of the script to `.js` and
>> tried this:
>> <script src="highlight-behavior.js">
>>
>> <script>
>>   Polymer({
>>     is: 'my-element',
>>     behaviors: [HighlightBehavior]
>>   });
>> </script>
>>
>> And it works fine.
>>
>> So I'm wondering is that a bug in docs or am I doing something wrong?
>>
>> Thx
>>
>> NanoWANG
>>
>  Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/39c9e7ea-8c1d-4785-925d-19ca997da7e2%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/39c9e7ea-8c1d-4785-925d-19ca997da7e2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CAEKsHmDWL7J_X3T7cSZBavsLAEgtYzShzUqm%3DmsxkuuMgeVtdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to