Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js"></script>
  </head>
  <body>
    
    <img is="my-avatar" service="twitter" username="leggetter" /> 
    
    <script>
      var MyAvatarPrototype = Object.create(HTMLImageElement.prototype);
  
      MyAvatarPrototype.createdCallback = function() {
        var username = this.getAttribute('username'),
            service = this.getAttribute('service'),
            url = 'http://avatars.io/' + service + '/' + username;
      
        this.setAttribute('src', url);
      };
      document.registerElement('my-avatar', {
        prototype: MyAvatarPrototype,
        extends: 'img'
      });
    </script>
    
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
leggetterpro
0viewers