Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a polymer element draggable
    primarykey
    data
    text
    <p>I'm trying to enable <strong>HTML5 drag and drop on a custom polymer element</strong> but it doesn't work. Without polymer it's possible to just add the <code>draggable</code> attribute.</p> <p>Here is my code in Dart:</p> <h3>my_component.html</h3> <pre class="lang-html prettyprint-override"><code>&lt;polymer-element name="my-component"&gt; &lt;template&gt; &lt;style&gt; @host { :scope { display: block; } } div { background-color: red; width: 200px; height: 200px; } &lt;/style&gt; &lt;div&gt; Drag me &lt;/div&gt; &lt;/template&gt; &lt;script type="application/dart" src="my_component.dart"&gt;&lt;/script&gt; &lt;/polymer-element&gt; </code></pre> <h3>my_component.dart</h3> <pre class="lang-dart prettyprint-override"><code>import 'package:polymer/polymer.dart'; @CustomTag('my-component') class MyComponent extends PolymerElement { MyComponent.created() : super.created(); } </code></pre> <h3>test.html</h3> <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="import" href="my_component.html"&gt; &lt;script type="application/dart"&gt;import 'package:polymer/init.dart';&lt;/script&gt; &lt;script src="packages/browser/dart.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;my-component draggable="true"&gt;&lt;/my-component&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I also tried extending directly from an HTML Element. This didn't work either.</p> <p><strong>Any ideas how a polymer element can be made draggable?</strong></p> <p>Edit: There is a <a href="https://code.google.com/p/dart/issues/detail?id=15564">Bug Report</a> for this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload