Registry / web-framework / closure-dom

closure-dom

JSON →
library1.0.0jsnpmunverified

Closure DOM provides lightweight, Closure Compiler-compatible DOM manipulation utilities for JavaScript. The package (v1.0.0) includes methods like addClass, getDocumentHeight, insert, setOpacity, and others, designed for simple reuse across projects. It has a stable release cadence with infrequent updates. Its key differentiators are compatibility with Google Closure Compiler's advanced optimizations and minimal overhead, making it suitable for compiled applications. Unlike larger libraries, it offers focused, composable functions without dependencies.

npm install closure-dom
INSTALL
IMPORT
SIG · CLOSURE-DOM
C
closure-dom
web-frameworkjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

addClass
import { addClass } from 'closure-dom';
import addClass from 'closure-dom';
Named import required; package exports multiple named functions, not a default export.
getDocumentHeight
import { getDocumentHeight } from 'closure-dom';
const { getDocumentHeight } = require('closure-dom');
ESM-only package; CommonJS require is not supported.
insert
import { insert } from 'closure-dom';
import { insertElement } from 'closure-dom';
Function named 'insert', not 'insertElement'.

Demonstrates importing and using four DOM utility functions: addClass, setOpacity, insert (not shown but imported), and getDocumentHeight.

import { addClass, getDocumentHeight, insert, setOpacity } from 'closure-dom'; const element = document.createElement('div'); addClass(element, 'highlight'); setOpacity(element, 0.5); document.body.appendChild(element); const height = getDocumentHeight(); console.log('Document height:', height);
Debug
Known issues
gotchaESM-only package: does not support CommonJS require(). Use ES module imports.
fix
Use import syntax instead of require().
affects: >=1.0.0
breakingAll methods are not available as default export. Must use named imports.
fix
Import each function by name: import { functionName } from 'closure-dom';
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Package is ESM-only; using import in CommonJS context
fix
Add "type": "module" to package.json or use .mjs extension
TypeError: closure_dom_1.addClass is not a function
Default import used instead of named import
fix
Change to: import { addClass } from 'closure-dom';
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
closure-dom — npm install closure-dom · libregistry