5
Skayo
6y

If somebody needs a project idea how about a really dumb JS Framework that allows you do basic DOM Manipulation, just like jQuery, directly in the elements class attribute.

For example this is how a document could look like:
<body class="init-hide-id-otherElement">
<button class="onclick-show-id-otherElement">
<h1 id="otherElement">Hello</h2>
</body>

What this does is first, at the body's init-* class, it hides the element with id otherElement at page load. Then, when you click the button, the element with id otherElement gets shown. Instead of *-id-* you could also use *-class-* which selects a class.
Basically the syntax is:
<event>-<action>-<id/class>-<the elements id/class>

Of course this has a lot of limitations, for example the selectors are very limited, but it would still be very cool!

Comments
  • 1
    If somebody implements this please tell me! xD
  • 5
    I still prefer organizing it on js file with addEventListener click, all of my buttons are there instead of putting it on html and find it later. But you can do this yourself with split etc
  • 2
    <@devTea>
    As I mentioned this shouldn't be a serious thing you would use in projects. It's for fun.
Add Comment