yombal-dom A small extension adding methods to Elements and Document Object to write less code and do more.
GPL-3.0 License
A small extension adding methods to Elements and Document Object to write less code and do more.
<template id="cardTemplate">
<div class="card">
<h1> {{ title }} </h1>
<p> {{ content }} </p>
</div>
</template>
let element = document.createElementFromTemplate("cardTemplate", {
title: "the title",
content: "the content"
})
<div class="card">
<h1> the title </h1>
<p> the content </p>
</div>
Element inherits the methods provided by the Node parent class and its parent class before it : EventTarget.
<div id="card">
<h1> {{ title }} </h1>
<p> {{ content }} </p>
</div>
let card = _("#card");
card.replaceMustachWithObjectValues({
title: "a title",
content: "A content of.."
})
<div class="card">
<h1> a title </h1>
<p> A content of.. </p>
</div>
insert
<script src="https://unpkg.com/[email protected]/utils.js" crossorigin="anonymous"></script>
in head tag
npm i yombal-dom
<script src="node_modules/yombal-dom/utils.js"></script>
in head tag before any scriptgit clone https://github.com/honorableCon/yombal-dom.git
utils.js
to your project directory<script src="utils.js"></script>
in head tag before any scripteNJOY !
Created by Honorable Con, M.E.R.N Stack developer
New methods suggestion or more.. You can tell me here or pull request.
This project is under the GPL V3 License
Jaajeuf!