hast-util-from-parse5
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -6,2 +6,4 @@ 'use strict' | ||
var find = require('property-information/find') | ||
var ns = require('web-namespaces') | ||
var s = require('hastscript/svg') | ||
var h = require('hastscript') | ||
@@ -52,4 +54,4 @@ var xtend = require('xtend') | ||
if (fn === element && schema.space === 'html' && ast.nodeName === 'svg') { | ||
config.schema = svg | ||
if (fn === element) { | ||
config.schema = ast.namespaceURI === ns.svg ? svg : html | ||
} | ||
@@ -136,2 +138,3 @@ | ||
function element(ast, children, config) { | ||
var fn = config.schema.space === 'svg' ? s : h | ||
var name = ast.tagName | ||
@@ -155,3 +158,3 @@ var attributes = ast.attrs | ||
node = h(name, props, children) | ||
node = fn(name, props, children) | ||
@@ -158,0 +161,0 @@ if (name === 'template' && 'content' in ast) { |
{ | ||
"name": "hast-util-from-parse5", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Transform Parse5’s AST to HAST", | ||
@@ -25,2 +25,3 @@ "license": "MIT", | ||
"property-information": "^4.0.0", | ||
"web-namespaces": "^1.1.2", | ||
"xtend": "^4.0.1" | ||
@@ -27,0 +28,0 @@ }, |
@@ -67,4 +67,5 @@ # hast-util-from-parse5 [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
If an `svg` element is found in the HTML space, `toHTML` automatically switches | ||
to the SVG space when entering the element, and switches back when leaving. | ||
If an element in with the SVG namespace is found in `ast`, `fromParse5` | ||
automatically switches to the SVG space when entering the element, and | ||
switches back when leaving. | ||
@@ -71,0 +72,0 @@ ###### `options.file` |
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
12518
192
169
5
+ Addedweb-namespaces@^1.1.2
+ Addedweb-namespaces@1.1.4(transitive)