@thi.ng/hiccup
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@2.6.1...@thi.ng/hiccup@2.7.0) (2018-12-13) | ||
### Features | ||
* **hiccup:** add __skip support, add test, update readme ([d3500df](https://github.com/thi-ng/umbrella/commit/d3500df)) | ||
## [2.6.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@2.6.0...@thi.ng/hiccup@2.6.1) (2018-12-08) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@thi.ng/hiccup", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"description": "HTML/SVG/XML serialization of nested data structures, iterables & closures", | ||
@@ -52,3 +52,3 @@ "main": "./index.js", | ||
}, | ||
"gitHead": "6e361d62fff19dbda467c13f375b0ebcb5d6d8a2" | ||
"gitHead": "e36a7ee080147d3ccbb464b0536c0ccc74ae1d01" | ||
} |
@@ -29,2 +29,3 @@ # @thi.ng/hiccup | ||
- [Component objects](#component-objects) | ||
- [Behavior control attributes](#behavior-control-attributes) | ||
- [API](#api) | ||
@@ -63,2 +64,3 @@ - [serialize(tree: any, ctx?: any, escape = false): string](#serializetree-any-ctx-any-escape--false-string) | ||
- Optional HTML entity encoding | ||
- Branch-local behavior control attributes to control serialization | ||
- Small (2.2KB minified) & fast | ||
@@ -455,2 +457,16 @@ | ||
### Behavior control attributes | ||
The following attributes can be used to control the serialization | ||
behavior of individual elements / tree branches: | ||
- **`__skip`** - if true, skips serialization (also used by | ||
[@thi.ng/hdom](https://github.com/thi-ng/umbrella/tree/master/packages/hdom)) | ||
- **`__serialize`** - if false, skips serialization (hiccup only) | ||
```ts | ||
serialize(["div.container", ["div", {__skip: true}, "ignore me"]]); | ||
// <div class="container"></div> | ||
``` | ||
## API | ||
@@ -527,2 +543,5 @@ | ||
Please also see list of supported [behavior control | ||
attributes](#behavior-control-attributes). | ||
### escape(str: string): string | ||
@@ -529,0 +548,0 @@ |
@@ -145,3 +145,3 @@ "use strict"; | ||
const attribs = tree[1]; | ||
if (attribs.__serialize === false) { | ||
if (attribs.__skip || attribs.__serialize === false) { | ||
return ""; | ||
@@ -148,0 +148,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61950
556