Gathering detailed insights and metrics for create-element-ns
Gathering detailed insights and metrics for create-element-ns
npm install create-element-ns
Typescript
Module System
Node Version
NPM Version
71.9
Supply Chain
88.7
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
8,574
Last Day
2
Last Week
13
Last Month
45
Last Year
316
61 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
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
-66.7%
2
Compared to previous day
Last week
-58.1%
13
Compared to previous week
Last month
1,025%
45
Compared to previous month
Last year
-56.2%
316
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
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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