New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-attributes-remover

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-attributes-remover

Remove html attributes like css classes, inline css, id from html

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Html Attributes Remover

About this Package

Provide a list of attributes you need to remove from provided html or selective tags of html

Install:

npm install html-attributes-remover

Remove html attributes like style, class from div tags

const AttributeRemover = require('html-attributes-remover').default
const attributeRemover   = new AttributeRemover({
  "htmlTags": ["div"],
  "attributes": ["style", "class"]
})

let html    = "<div class='row' style='color:red;'><p><span style='font-size:100;'>Hello there!</span></p></div>"
let newHtml = attributeRemover.remove(html)
console.log(newHtml) // "<div><p><span style='font-size:100;'>Hello there!</span></p></div>"

If you want to remove attributes from all html tags then do not mention any htmlTags while initializing the AttributeRemover class

Keywords

FAQs

Package last updated on 02 Mar 2019

Did you know?

Socket

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.

Install

Related posts

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