Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

card-fill.html 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template id="card-fill">
  2. <style id="style">
  3. :host {flex: 1;}
  4. </style>
  5. </template>
  6. <script>
  7. (function(window, document) {
  8. var elemName = 'card-fill';
  9. var mainDoc = document;
  10. var importDoc = document.currentScript.ownerDocument;
  11. var proto = Object.create(HTMLElement.prototype);
  12. Object.defineProperty(proto, "size", {
  13. get: function() {
  14. return "";
  15. },
  16. set: function (value) {
  17. this.setAttribute('size', value);
  18. var root = this.shadowRoot;
  19. var style = root.getElementById("style");
  20. style.innerHTML = ":host{flex:"+value+"}"
  21. }
  22. });
  23. proto.createdCallback = function () {
  24. var template = importDoc.getElementById(elemName);
  25. var clone = mainDoc.importNode(template.content, true);
  26. var root = this.createShadowRoot();
  27. root.appendChild(clone);
  28. this.size = this.getAttribute('size') || "1";
  29. }
  30. proto.attributeChangedCallback = function (name, oldValue, newValue) {
  31. switch (name) {
  32. case "size": this.size = newValue; break;
  33. }
  34. }
  35. mainDoc.registerElement(elemName, { prototype: proto });
  36. })(window, document);
  37. </script>