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

base-element

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-element - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

15

index.js
module.exports = BaseElement
var document = require('global/document')
var serialize = require('min-document/serialize')
var h = require('virtual-dom/h')

@@ -9,2 +7,3 @@ var diff = require('virtual-dom/diff')

var createElement = require('virtual-dom/create-element')
var toHTML = require('vdom-to-html')

@@ -15,3 +14,3 @@ function BaseElement (el) {

this.element = null
this.__appendTo__ = (typeof el === 'undefined' || el === null) ? document.body : el
this.__appendTo__ = el
this.__events__ = Object.create(null)

@@ -45,3 +44,3 @@ this.__BaseElementSig__ = 'be-' + Date.now()

this.element = createElement(this.vtree)
if (this.__appendTo__ !== false) {
if (this.__appendTo__) {
this.__appendTo__.appendChild(this.element)

@@ -59,7 +58,3 @@ }

this.render.apply(this, arguments)
try {
return serialize(this.element)
} catch (err) {
return this.element.outerHTML
}
return toHTML(this.vtree)
}

@@ -78,3 +73,3 @@

BaseElement.prototype.on = function (name, cb) {
BaseElement.prototype.addEventListener = function (name, cb) {
if (!Array.isArray(this.__events__[name])) this.__events__[name] = []

@@ -81,0 +76,0 @@ this.__events__[name].push(cb)

{
"name": "base-element",
"version": "2.2.0",
"version": "3.0.0",
"description": "An element authoring library for creating standalone and performant elements.",
"main": "index.js",
"scripts": {
"test": "standard --format && node test/server.js && zuul --local 9966 -- test/index.js",
"test": "standard && node test/server.js && zuul --local 9966 -- test/index.js",
"ci": "standard && node test/server.js && zuul -- test/index.js",

@@ -36,3 +36,3 @@ "start": "budo examples/standalone.js",

"devDependencies": {
"attach-css": "^1.0.0",
"attach-css": "^1.1.0",
"babelify": "^6.0.2",

@@ -42,4 +42,4 @@ "browser-test-helpers": "^1.0.0",

"budo": "^4.0.0",
"standard": "^3.7.2",
"tap-spec": "^3.0.0",
"standard": "^4.0.0",
"tap-spec": "^4.0.0",
"tape": "^4.0.0",

@@ -49,6 +49,5 @@ "zuul": "^3.0.0"

"dependencies": {
"global": "^4.3.0",
"min-document": "^2.14.1",
"vdom-to-html": "^2.1.1",
"virtual-dom": "^2.0.1"
}
}

@@ -103,3 +103,3 @@ # base-element

var button = require('your-button')()
button.on('clicked', function (node) {
button.addEventListener('clicked', function (node) {
button.render('button label ' + Math.random())

@@ -145,3 +145,3 @@ })

// When we receive a "changed" event from InputBox, handle it here
this.on('changed', function (text) {
this.addEventListener('changed', function (text) {
/* Perform some email validation on text here,

@@ -196,7 +196,7 @@ then render() if we need an update */

### `element.on(name, function)`
### `element.addEventListener(name, function)`
Register an event listener for a given name:
```js
element.on('clicked', function (params) {})
element.addEventListener('clicked', function (params) {})
```

@@ -245,6 +245,6 @@

BaseElement.call(this, el)
this.on('load', function (node) {
this.addEventListener('load', function (node) {
console.log(node + ' has loaded!')
})
this.on('unload', function (node) {
this.addEventListener('unload', function (node) {
console.log(node + ' has unloaded!')

@@ -251,0 +251,0 @@ })

Sorry, the diff of this file is too big to display

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