Also, make sure that you include platform.js before any other script on the
page.


On Mon, Mar 10, 2014 at 5:42 PM, Scott Miles <[email protected]> wrote:

> >> But the library throws an exception since it is expecting a native
> version of the div and instead gets a wrapped one
>
> This is the key moment. We need to know what the library is trying to do
> that is not supported by the wrapper.
>
> Trying to 'unwrap' the wrapper is absolutely the last resort, and usually
> causes more trouble that it's worth. I know this from personal experience.
> =P
>
> Scott
>
>
>
> On Mon, Mar 10, 2014 at 2:35 PM, <[email protected]> wrote:
>
>> Hello,
>>
>> I am working on a project in which I am supposed to construct a graph
>> with several nodes and edges using Polymer and Platform. I am using an
>> underlying library which is developed in-house by my company which is not
>> based on Polymer. This library contains functions for creating nodes,
>> initializing graph etc.I have created a custom element called graph.
>> Following is the declaration of this element:
>>
>> <pre>
>> <polymer-element name="cmp-graph" attributes="canvas"
>> constructor="CMPGraph">
>>
>> <template>
>>           <div id="graph_win_placeholder">
>>             <div id="graph_win" class="canvas">
>>                 <div id="graph_canvas" class="graph-area">
>>                 </div>
>>             </div>
>>           </div>
>> </template>
>>
>> </polymer-element>
>> </pre>
>>
>> In Javascript I call a function of the library to initialize the graph.
>> This function call needs a handle to the canvas div (the div with
>> id="graph_canvas"). So I pass this.$.graph_canvas as a parameter while
>> making the function call. But the library throws an exception since it is
>> expecting a native version of the div and instead gets a wrapped one since
>> this.$.graph_canvas corresponds to the wrapped version of the div and not
>> the actual native one. So I tried to unwrap this.$.graph_canvas. Now the
>> next problem comes into picture when the library is trying to create some
>> DOM elements using document.createElement .document.createSVGElement etc.
>> Now these elements that are created by the library are wrapped (since
>> platform.js and polymer.js are already loaded) and the library again throws
>> an error.
>> So inorder to solve this problem, I passed shadow=native as a parameter
>> in the query string and everything works fine. The library is happy and so
>> is my code.
>>
>> But now the problem is, my application can run only on Chrome and Opera
>> since other browsers do not have the native support for Shadow DOM. Is
>> there any other way to solve this problem?
>>
>> Any help will be appreciated.
>>
>> Thanks.
>>
>> 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/701bc577-457a-44f9-ba55-e4bb511fb045%40googlegroups.com<https://groups.google.com/d/msgid/polymer-dev/701bc577-457a-44f9-ba55-e4bb511fb045%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/CAHbmOLbyYyQB7uVMx7_LtaROcBWBT1ww%3Dof-Qr-rH6FSqo3ySg%40mail.gmail.com<https://groups.google.com/d/msgid/polymer-dev/CAHbmOLbyYyQB7uVMx7_LtaROcBWBT1ww%3Dof-Qr-rH6FSqo3ySg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
erik

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/CAJ8%2BGogKm3cj7ur%3Dco_ndvuRVzXbj-jxxpYMjTpp7FUiyoLA8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to