Created
June 17, 2018 15:43
-
-
Save RakeshChouhan/c686ab6609379d058de756e17881b1ca to your computer and use it in GitHub Desktop.
Web component creation without any framework.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PopUpInfo extends HTMLElement{ | |
constructor(){ | |
super(); | |
this.attachFunctionality(); | |
} | |
attachFunctionality(){ | |
var shadow = this.attachShadow({mode:'open'}); | |
var span = document.createElement("span"); | |
span.innerHTML = "Hi Rakesh! your first html Element... Congratulations ..."; | |
shadow.appendChild(span); | |
} | |
} | |
(function(){ | |
alert("hello"); | |
customElements.define("pop-up-info", PopUpInfo); | |
}()) | |
// In Html add element <pop-up-info></pop-up-info> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment