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

dom-ot

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-ot - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

33

index.js

@@ -12,2 +12,3 @@ var domSerialize = require('serialize-dom')

exports.apply = function(snapshot, ops) {
snapshot = snapshot.cloneNode(true)
unpackOps(ops)

@@ -36,3 +37,3 @@ .forEach(function(op) {

range = range.cloneRange()
if(rootNode.contains(range.startContainer)) {
if(rootNode.contains(range.startContainer) && range.startContainer.nodeValue) {
var cs = Changeset.create()

@@ -47,7 +48,6 @@ .retain(range.startOffset)

var cursorOp = cursorOps[0]
var length = countInitialRetains(cursorOp.diff)
if(cursorOp.path === null) range.collapse(false)
else range.setStart(nodeAt(cursorOp.path, rootNode), length)
var start = nodeAt(cursorOp.path, rootNode)
var startLength = countInitialRetains(cursorOp.diff)
}
if(rootNode.contains(range.endContainer)) {
if(rootNode.contains(range.endContainer) && range.endContainer.nodeValue) {
var cs = Changeset.create()

@@ -62,7 +62,26 @@ .retain(range.endOffset)

var cursorOp = cursorOps[0]
var end = nodeAt(cursorOp.path, rootNode)
var length = countInitialRetains(cursorOp.diff)
if(cursorOp.path === null) range.collapse(true)
else range.setEnd(nodeAt(cursorOp.path, rootNode), length)
}
try {
if(!start) range.collapse(false)
else range.setStart(start, length)
if(!end) range.collapse(true)
else range.setEnd(end, length)
}catch(e) {
}
try {
if(!end) range.collapse(true)
else range.setEnd(end, length)
if(!start) range.collapse(false)
else range.setStart(start, length)
}catch(e) {
}
return range

@@ -69,0 +88,0 @@ }

{
"name": "dom-ot",
"version": "1.2.3",
"version": "1.2.4",
"description": "Operational transform library for DOM operations (conforms to shareJS' spec)",

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

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