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.8 to 4.0.9

18

htmldom.umd.js

@@ -135,6 +135,15 @@ (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){

let nodes
let { nodes } = new HtmlParser(content)
for (let item of this) {
if (item.tagType === 'rawTag') {
item.textContent = content
continue
}
for (let item of this) {
if (!nodes) {
let parser = new HtmlParser(content)
nodes = parser.nodes
}
item.children = nodes.map(node => {

@@ -580,2 +589,7 @@ node.parent = item

// script, style, textarea
if (node.tagType === 'rawTag') {
return node.textContent
}
for (let i = 0; i < children.length; i++) {

@@ -582,0 +596,0 @@ html += getOuterHTML(children[i])

@@ -47,6 +47,15 @@ let QuerySelector = require('./query.selector')

let nodes
let { nodes } = new HtmlParser(content)
for (let item of this) {
if (item.tagType === 'rawTag') {
item.textContent = content
continue
}
for (let item of this) {
if (!nodes) {
let parser = new HtmlParser(content)
nodes = parser.nodes
}
item.children = nodes.map(node => {

@@ -53,0 +62,0 @@ node.parent = item

@@ -66,2 +66,7 @@ const { getAttributesCode } = require('./node.op')

// script, style, textarea
if (node.tagType === 'rawTag') {
return node.textContent
}
for (let i = 0; i < children.length; i++) {

@@ -68,0 +73,0 @@ html += getOuterHTML(children[i])

2

package.json
{
"name": "htmldom",
"version": "4.0.8",
"version": "4.0.9",
"description": "Simplified html handle in nodejs",

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

@@ -281,6 +281,8 @@ # htmldom — Simplified html or xml handle in nodejs

$('script').each((index, item) => {
let type = $(item).attr('type')
let $item = $(item)
let type = $item.attr('type')
let src = $item.attr('src')
if ((type && type !== 'text/javascript') || src) return
if (type && type !== 'text/javascript') return
// Find a uglify plugin by yourself

@@ -287,0 +289,0 @@ item.textContent = uglifyJs(item.textContent)

@@ -23,2 +23,14 @@ let assert = require('assert')

})
it('script', function() {
let $ = createHtmlDom(`<script> console.log('') </script>`)
assert.equal($('script').html(), ` console.log('') `)
})
it('style', function() {
let $ = createHtmlDom(`<style>.titletl{}</style>`)
assert.equal($('style').html(), `.titletl{}`)
})
})

@@ -58,2 +70,14 @@

})
it('script', function() {
let $ = createHtmlDom('<script></script><script></script>')
$('script').html('alert(1)')
assert.equal($.nodes[0].textContent, 'alert(1)')
assert.deepEqual($.nodes[0].children, [])
assert.equal($.html(), `<script>alert(1)</script><script>alert(1)</script>`)
})
})
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