Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Operational transform library for DOM operations (conforms to shareJS' spec)
The DOM changes. You can capture those changes and sync multiple documents in real-time using this library to transform the changes for automagic conflict resolution.
Sounds awesome? It is. To learn more about operational transformation, go to wikipedia or check out this guide to textual ot. Also, check out gulf-contenteditable for a ready-made wrapper.
npm install dom-ot
The object you get from require('dom-ot')
is a full-featured shareJS ottype. This allows you to use dom-ot together with shareJS or the more unixy gulf. The shareJS interface will deal only with edits. An edit is essentially an array of operations.
This operation allows you to move a node from one path to another.
Set fromPath
to null to insert a node into the tree (which should be passed as serializedNode
, serialized with vdom-serialize).
Set toPath
to null, to remove a node from the tree (you should also pass serializedNode
here to enable inversion of the operation).
This operation allows you to set an attribute named attribute
of a given node at path
to a specific value
. Set value to null to remove the attribute.
This operation allows you to modify the nodeValue
of a text node, by specifying a diff (which should be a packed changeset).
Transforms this operation in-place against another one, so that it assumes the changes of the other one have already happened. Use left
to break ties.
Inverts the operation in-place.
Apply an operation on a document, specified by rootNode
. Optionally, you may set index
to true
, to automatically index nodes for importing MutationSummaries (see the mutationSummary adapter).
Usually you will not create these operations by hand: Fortunately there's a handy adapter that will turn MutationObserver summaries into dom-ot edits. Currently there's only an import method available that allows you to convert mutation summaries into dom-ot edits, but not the other way around. I simply couldn't find a use case for that, so that's it.
summary
is a summary object as returned by MutationSummaryrootNode
is the rootNode that was observed
Before installing a MutationObserver with MutationSummary and importing the changes with this function, you will need to run an indexing function on the rootNode, so that the adapter can figure out where the nodes were before. Also, you need to continuously index newly inserted or moved nodes. You can set the optional index
param of <Operation>#apply
to true
, to do this automatically and efficiently.Creates an index for all children of rootNode which is necessary for import()
to work.
Run browserify test/tests.js > bundle.js
, then open test/index.html
in the browser of your choice.
v3.0.0
(c) 2015 by Marcel Klehr
Licensed under the terms of the LGPL. See LICENSE.txt
in the root directory of this project.
FAQs
Operational transform library for DOM operations (conforms to shareJS' spec)
The npm package dom-ot receives a total of 40 weekly downloads. As such, dom-ot popularity was classified as not popular.
We found that dom-ot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.