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

htmldom

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmldom - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

11

htmldom.umd.js

@@ -232,2 +232,9 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.createHtmlDom = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

}
/**
* @example
* $('div').replaceWith('<view>1</view>')
*/
replaceWith (content) {
return this.before(content).remove()
}

@@ -1097,2 +1104,4 @@ /**

constructor (selector, rootNode) {
this.__root__ = rootNode
if (isString(selector)) {

@@ -1107,4 +1116,2 @@ this.selector = selector

this.__root__ = rootNode
depthFirstSearch(rootNode, function (node) {

@@ -1111,0 +1118,0 @@ if (cssMatch(node, first)) {

4

lib/query.selector.js

@@ -122,2 +122,4 @@ let { parser : cssParser, match: cssMatch} = require('./selector')

constructor (selector, rootNode) {
this.__root__ = rootNode
if (isString(selector)) {

@@ -132,4 +134,2 @@ this.selector = selector

this.__root__ = rootNode
depthFirstSearch(rootNode, function (node) {

@@ -136,0 +136,0 @@ if (cssMatch(node, first)) {

{
"name": "htmldom",
"version": "4.0.3",
"version": "4.0.4",
"description": "Simplified html handle in nodejs",

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

@@ -28,3 +28,19 @@ let assert = require('assert')

})
it('each replaceWith', function() {
let $ = createHtmlDom('<li>1</li><li>2</li>')
$('li').each((index, item) => {
let $item = $(item)
$item.replaceWith(`<view>${$item.html()}</view>`)
})
assert.equal($('view').length, 2)
assert.equal($('li').length, 0)
assert.equal($('view')[0].parent, null)
assert.equal($('view')[1].parent, null)
})
})

Sorry, the diff of this file is not supported yet

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