Socket
Book a DemoInstallSign in
Socket

horsy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

horsy

maybe to react what react is to hyperscript?

latest
Source
npmnpm
Version
2.3.0
Version published
Maintainers
1
Created
Source

horsy

html-like markup in template literals!

write html. get elements. No compiling .jsx

import h, { setChildren } from '../lib'
let name = 'World'
let style = 'color: red;'
let elements = h`<span class='greeting'>Hello</span> <span class='name' style=${style}>${name}</span>!`
setChildren(document.body, elements)

but it's not really html, is it?

well, no... it only handles elements and doesn't check that your tags are valid or anything

let elements = h`
<!DOCTYPE html>
<input autofocus>
<!-- comment -->
`

nope nope nope

Ugh! not another bloated framework!

I feel you! This won't solve all your problems for you. This just turns markup into dom elements.

There's around 200 code-golf-free lines with no external dependencies. you can read through all the code and understand every subtle nuance in a few minutes

The gzipped minified version is 2k

todo

  • handle xml != html?
    • handle attributes without values <input autofocus/>
    • handle elements without closing tags <br>
  • less adding and removing when splicing child nodes lists
  • that templating thing that lit does might be cool (or some other way to not create new elements when updating big blocks of html)...

FAQs

Package last updated on 02 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts