Gathering detailed insights and metrics for create-element-ns
Gathering detailed insights and metrics for create-element-ns
Gathering detailed insights and metrics for create-element-ns
Gathering detailed insights and metrics for create-element-ns
dom createElement hyperscript with svg, namespace and selector support
npm install create-element-ns
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
61 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Apr 18, 2021
Latest Version
3.3.1
Package Id
create-element-ns@3.3.1
Unpacked Size
17.05 kB
Size
6.11 kB
File Count
20
NPM Version
6.13.7
Node Version
13.11.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
dom createElement
and createElementNS
hyperscript with svg, namespace and selector support
• Example • Features • API • License
1var CE = require('create-element-ns') 2var el = CE.el 3 4// selectors or attributes 5var divEl1 = el('div.c1#i1[style="color:blue"].c2', {onclick: function() {}})(), 6 divEl2 = el('div.i1', {style: {color: 'blue'}, props:{className: 'c1 c2', , onclick: function() {}}})(), 7 divEl3 = el('div.c1#i1[style="color:blue"].c2')({onclick: function() {}}), 8 9// namespace in different ways 10var circleEl1 = el('svg:circle')(), 11 circleEl2 = el.svg('circle')(), 12 circleEl3 = el('circle[xmlns=http://www.w3.org/2000/svg]') 13 circleEl3 = el('circle', {xmlns : 'http://www.w3.org/2000/svg'}) 14 15// partial application to create multiple modified clones 16var pFn = el('p'), 17 pEl = pFn({textContent: 'x'}) 18 19// factory functions can be nested, with or without arrays 20var olFn = el('ol', el('li', 'one'), [el('li', 'two'), el('li', 'three')]), 21 olEl = pFn()
document API
for server and/or testing (e.g. jsdom
)There are many hyperscript modules out there (docrel, create-element-from-selector, domator, makeelement, simpel to name a few) but they either don't support namespaces, like svg or are more oriented to virtual-dom applications.
To create an element factory (function that return a DOM Element):
el(definition [, options][, content])
=> elementFactory
el.svg(definition [, options][, content])
=> elementFactory
elementFactory([optionObject])
=> DOM Element
Parameters and outputs
definition
: a string selector, elementFactory
or DOM Elementoptions
: {properties:{}, attributes:{}, style:{}, dataset:{}}
or {props:{}, attrs:{}, style:{}, dataset:{}}
content
: optional series or array of string, Element
or elementFactory
CE.global.document
injects an external document API like jsdom
. Uses the global document
if not specified.CE.namespaces
adds additional namespace prefix (svg is already defined). E.g. CE.namespaces.xlink: 'http://www.w3.org/1999/xlink'
CE.decorators
to add element decorators E.g. CE.decorators.a = CE.decorators.attributes
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More