Skip to content

Commit

Permalink
v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfranzl committed Apr 22, 2020
1 parent 3f0d550 commit b410a9d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 63 deletions.
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

WIP

## [4.0.0] - 2020-04-21

### Changed

#### Breaking changes

- Function `sanitizeHtml` now returns a HTML string instead of a DOM node snapshot.
- Arguments for filter functions changed from `node, parents, parentNodeNames` to
`node, { parents, parentNodeNames }`.

#### Other changes

- Changed the default value of option `remove_tags_deep` from `{ '.*': ['style', 'script',
'textarea', 'noscript'] }` to `{}`.
- Repository organization: Extraction of library functions into separate files.
- Code style improvements using `eslint`.
- Performance: Regular expressions in options are now precompiled.
- Testing: Change to ES6 module format.
- Testing: Use Node's built-in function `assert`.
- Testing: Support for browsers as well as Node.js.
- Testing: Switch from Jenkins to Github actions.

### Removed

#### Breaking

- Function `sanitizeDom` is no longer exported. It's internal use only. Use instead its wrappers
`sanitizeNode`, `sanitizeChildNodes`, and `sanitizeHtml`.
- Removed recognition of the custom DOM Node properties `sanitize_skip_filters`, `sanitize_skip`,
`sanitize_skip_filter_classes`, and `sanitize_skip_filter_attributes`. These are now stored in a
`WeakMap` without their `sanitize_` prefix. See `README` for more information.
- Regular expression matching of node names removed wrapping between `^` and `$` to increase flexibility.

### Added

- Added new option `allowed_empty_tags` to provide exceptions when `options.remove_empty` is set.
- Added argument `siblingIndex` to filter functions.
- Case-insensitive matching of tag names given in options.

### Fixed

- Filtering of attributes was broken (it operated on a live node set instead of a snapshot)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Michael Franzl
Copyright (c) 2020 Michael Franzl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
72 changes: 14 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanitize-dom",
"version": "3.0.2",
"version": "4.0.0",
"description": "Recursive sanitizer/filter for WHATWG DOMs",
"main": "src/index.js",
"scripts": {
Expand All @@ -26,15 +26,13 @@
},
"homepage": "https://github.com/michaelfranzl/sanitize-dom",
"devDependencies": {
"@jspm/core": "^1.0.4",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-mocha": "^6.2.2",
"jsdoc-to-markdown": "^5.0.3",
"jsdom": "^16.2.1",
"mocha": "^7.1.1",
"showdown": "^1.8.2"
"mocha": "^7.1.1"
},
"type": "module"
}

0 comments on commit b410a9d

Please sign in to comment.