6
votes

I've two polymer elements that share the same dart file. In the dart file I declare both the PolymerElement classes.

Until polymer 0.15.0+1 it was working fine. I've updated the project to polymer 0.15.1 and now I get this exception:

Exception: Already registered (Polymer) prototype for element x

Where x is the first polymer.

I think the polymer transformer is trying to register it two times, the first scanning the x polymer html file, the second when scanning the other element html file.

An issue has been open in dart: https://code.google.com/p/dart/issues/detail?id=21332

2
I think you should file a bug report at dartbug.com/newGünter Zöchbauer

2 Answers

9
votes

I don't know about Dart and whatnot, but I had the same error message in my console. Turns out I was still having the noscript attribute in my element declaration, which is wrong if you want to register your element manually. Removing noscript from the element declaration solved the problem.

0
votes

The issue has been "resolved" with the release 0.15.1+2 of Polymer Dart.

The compiler now throws a warning, and as stated in the issue comments: "The real solution for you here should be to put your script file in its own html file, and import that instead of your script. In summary you have to create an HTML file (e.g. script_thats_used_multiple_times.html) with the following content:

<!DOCTYPE html>
<script type="application/dart" src="script_thats_used_multiple_times.dart"></script>

then of course delete the original from all polymer components that used this file previously and put the import above the

<link rel="import" href="script_thats_used_multiple_times.html">

which will import previously created HTML file. Simple."