Skip to content
This repository was archived by the owner on Sep 25, 2022. It is now read-only.

Add constructor #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion my-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
(function() {
// Creates an object based in the HTML Element prototype
var element = Object.create(HTMLElement.prototype);



// the function ElementConstructor is a unique constructor that first calls
// the superclass (parent class), HTMLElement's, constructor with
// the context of the new element object, then allows for
// modification of the new object, the constructor's context.
element.prototype.constructor = function ElementConstructor() {
HTMLElement.apply(this, arguments);
// do other stuff with element object on construct invocation
}
// Fires when an instance of the element is created
element.createdCallback = function() {};

Expand Down