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

react-faux-dom

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-faux-dom - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

.quicksave.vim

13

package.json
{
"name": "react-faux-dom",
"version": "1.1.0",
"version": "2.0.0",
"description": "DOM like data structure to be mutated by D3 et al, then rendered to React elements",

@@ -32,10 +32,13 @@ "main": "src/ReactFauxDOM.js",

"faucet": "0.0.1",
"nodemon": "^1.6.1",
"react": "^0.13.3",
"nodemon": "^1.7.1",
"react": "^0.14.0",
"sinon": "^1.17.1",
"standard": "^5.1.0",
"tape": "^4.2.0"
"tape": "^4.2.1"
},
"dependencies": {
"lodash.assign": "^3.2.0",
"lodash.camelcase": "^3.0.1",
"lodash.clone": "^3.0.3",
"lodash.mapvalues": "^3.0.1",
"query-selector": "^1.0.9",

@@ -45,4 +48,4 @@ "style-attr": "^1.0.1"

"peerDependencies": {
"react": "0.x"
"react": "*"
}
}

@@ -5,2 +5,4 @@ var React = require('react')

var camelCase = require('lodash.camelcase')
var assign = require('lodash.assign')
var mapValues = require('lodash.mapvalues')
var querySelectorAll = require('query-selector')

@@ -12,2 +14,3 @@

this.children = []
this.eventListeners = {}
this.text = ''

@@ -119,7 +122,17 @@ var props = this.props = {

Element.prototype.addEventListener = function (name, fn) {
this.props[this.eventToPropName(name)] = fn
var prop = this.eventToPropName(name)
this.eventListeners[prop] = this.eventListeners[prop] || []
this.eventListeners[prop].push(fn)
}
Element.prototype.removeEventListener = function (name, fn) {
delete this.props[this.eventToPropName(name)]
var listeners = this.eventListeners[this.eventToPropName(name)]
if (listeners) {
var match = listeners.indexOf(fn)
if (match !== -1) {
listeners.splice(match, 1)
}
}
}

@@ -224,2 +237,17 @@

assign(props, mapValues(this.eventListeners, function (listeners) {
return function (syntheticEvent) {
var event
if (syntheticEvent) {
event = syntheticEvent.nativeEvent
event.syntheticEvent = syntheticEvent
}
mapValues(listeners, function (listener) {
listener(event)
})
}
}))
return React.createElement(this.nodeName, props, this.text || this.children.map(function (el, i) {

@@ -226,0 +254,0 @@ if (el instanceof Element) {

@@ -55,3 +55,3 @@ var test = require('tape')

t.plan(1)
t.equal(typeof el.props.onMouseOver, 'function')
t.equal(typeof el.eventListeners.onMouseOver[0], 'function')
})

@@ -58,0 +58,0 @@

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