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

how to get inner element #280

Closed
icode opened this issue Sep 16, 2013 · 1 comment
Closed

how to get inner element #280

icode opened this issue Sep 16, 2013 · 1 comment

Comments

@icode
Copy link

icode commented Sep 16, 2013

    <polymer-element name="ui-download-percentage">
        <template>
            <style>
                @host {
                    ui-download-percentage {

                    }
                }
            </style>
            <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
                <path transform="matrix(1,0,0,1,-28,96)"/>
            </svg>
        </template>
        <script>
            Polymer('ui-download-percentage', {
                enteredDocument: function () {
                    var pathEl = this.impl.querySelector('svg>path');
                }
            });
        </script>
    </polymer-element>

like this? how to get template generate element?
what's enteredDocument callback ?

@ebidel
Copy link
Contributor

ebidel commented Sep 17, 2013

This is a great question for stack overflow :) Closing this as it's not a request/bug. report


To answer your question, the best way is to add an id to <path> and reference it that way:

 <path id="path" transform="matrix(1,0,0,1,-28,96)"/>
 ....
 enteredDocument: function () {
    var pathEl = this.$.path
  }

Full example: http://jsbin.com/arumUq/3/edit

enteredDocument (now enteredView maps to the custom element lifecycle callback, enteredViewCallback:
http://www.polymer-project.org/polymer.html#lifecyclemethods

For your case, you can stick with the created callback.

@ebidel ebidel closed this as completed Sep 17, 2013
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

2 participants