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

[0.9] Extends delays/breaks polymer element setup #1575

Closed
Xaratas opened this issue May 20, 2015 · 1 comment
Closed

[0.9] Extends delays/breaks polymer element setup #1575

Xaratas opened this issue May 20, 2015 · 1 comment

Comments

@Xaratas
Copy link

Xaratas commented May 20, 2015

Tested in FF 38, stipped down version of my actual code.

Error Message:
TypeError: dialogueLink.fromXML is not a function
dialogueLink.fromXML();

Without the extends in this testcase it works.

In my actual code (https://github.com/Xaratas/PillarsOfEternity-Quest-Editor) i have build drag and drop, which creates DialogueLink elements via the constructor. These are created fully, and have all expected polymer properties and my functions.

I spotted the difference between my working Links from drag and drop and the links from my xml setup. In the drag and drop case i add the element to the dom.
I have a line for this below, but it still prints the error.
Other, non extends elements i create does not have to be added to the dom to call my functions, thats why i think this is a bug.

<!DOCTYPE html>
<html>
  <head>
    <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
    <link rel="import" href="bower_components/polymer/polymer.html">
  </head>

  <body>
<script>

</script>

    <script>
         document.addEventListener('WebComponentsReady', function() {
        DialogueLink = Polymer({
            is: "dialogueLink-element",
            extends: "canvas", // comment out and it works

            properties: {
                randomWeight: Number,
                playQuestionNodeVO: Boolean,
                questionNodeTextDisplay: String,
                startElement: Object,
                endElement: Object
            },

            // ist vor dem Behavior dran
            factoryImpl: function(startElement, endElement) {
                this.startElement = startElement;
                this.endElement = endElement;
            },

            created: function() {
                console.log("created and prototype ready");
            },

            fromXML: function(xml) {
                console.log("fromXML");
            }
        });

            var dialogueLink = new DialogueLink(); // parameter doesnt really matter for this test
               // uncomment, and it will setup the canvas as polymer element, but in this function fromXML() would still "not exist"
               // document.getElementsByTagName("body")[0].appendChild(dialogueLink);
            dialogueLink.fromXML();
        });
    </script>

</body>
</html>
@sorvell
Copy link
Contributor

sorvell commented May 23, 2015

The issue here is a CustomElements polyfill limitation. The createElement call fails if the extended element is created with an uppercase character in the name.

is: "dialogueLink-element", // make the `L` here lowercase and it'll work

Closed in favor of webcomponents/webcomponentsjs#313.

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

No branches or pull requests

3 participants