• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WebReflection / hyperHTML / 5760316994

pending completion
5760316994

push

github

web-flow
Explicit Maintenance Mode

This MR explains why nobody should waste time to remove code that just works for a library that also just works.

209 of 267 branches covered (78.28%)

Branch coverage included in aggregate %.

314 of 347 relevant lines covered (90.49%)

14.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.1
/cjs/hyper/render.js
1
'use strict';
2
const WeakMap = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('@ungap/weakmap'));
1!
3
const tta = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('@ungap/template-tag-arguments'));
1!
4

5
const {OWNER_SVG_ELEMENT} = require('../shared/constants.js');
1✔
6
const {Tagger} = require('../objects/Updates.js');
1✔
7

8
// a weak collection of contexts that
9
// are already known to hyperHTML
10
const bewitched = new WeakMap;
1✔
11

12
// better known as hyper.bind(node), the render is
13
// the main tag function in charge of fully upgrading
14
// or simply updating, contexts used as hyperHTML targets.
15
// The `this` context is either a regular DOM node or a fragment.
16
function render() {
1✔
17
  const wicked = bewitched.get(this);
111✔
18
  const args = tta.apply(null, arguments);
111✔
19
  if (wicked && wicked.template === args[0]) {
111✔
20
    wicked.tagger.apply(null, args);
42✔
21
  } else {
22
    upgrade.apply(this, args);
69✔
23
  }
24
  return this;
111✔
25
}
26

27
// an upgrade is in charge of collecting template info,
28
// parse it once, if unknown, to map all interpolations
29
// as single DOM callbacks, relate such template
30
// to the current context, and render it after cleaning the context up
31
function upgrade(template) {
1✔
32
  const type = OWNER_SVG_ELEMENT in this ? 'svg' : 'html';
69✔
33
  const tagger = new Tagger(type);
69✔
34
  bewitched.set(this, {tagger, template: template});
69✔
35
  this.textContent = '';
69✔
36
  this.appendChild(tagger.apply(null, arguments));
69✔
37
}
38

39
Object.defineProperty(exports, '__esModule', {value: true}).default = render;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc