Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nanocomponent

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanocomponent - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

11

index.js
var onload = require('on-load')
var assert = require('assert')
var KEY = 'ncid-' + (new Date() % 9e6).toString(36)
var INDEX = 0
module.exports = Nanocomponent

@@ -8,2 +11,3 @@

this._hasWindow = typeof window !== 'undefined'
this._ID = KEY + '-' + INDEX++
this._placeholder = null

@@ -29,2 +33,8 @@ this._onload = onload

this._element = this._render.apply(this, args)
// Get ID - needed for nanomorph child element reordering
var id = this._element.getAttribute('id')
if (!id) this._element.setAttribute('id', this._ID)
else this._ID = id
this._onload(this._element, function () {

@@ -59,2 +69,3 @@ self._loaded = true

el.setAttribute('data-nanocomponent', '')
el.setAttribute('id', this._ID)
var self = this

@@ -61,0 +72,0 @@ el.isSameNode = function (el) {

2

package.json
{
"name": "nanocomponent",
"version": "4.0.0",
"version": "4.0.1",
"description": "Create performant HTML elements",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,7 +22,13 @@ # nanocomponent [![stability][0]][1]

this._color = color
return html`
<button style="background-color: ${color}">
Click Me
</button>
`
if (!this._element) {
// initial render
return html`
<button style="background-color: ${color}">
Click Me
</button>
`
} else {
// mutate this._element
this._element.style.backgroundColor = color
}
}

@@ -80,3 +86,4 @@

Inheritable Nanocomponent prototype. Should be inherited from using
`Nanococomponent.call(this)` and `prototype = Object.create(Nanocomponent)`.
`Nanococomponent.call(this)` and `prototype =
Object.create(Nanocomponent.prototype)`.

@@ -83,0 +90,0 @@ Internal properties are:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc