hast-util-to-dom
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -5,3 +5,3 @@ 'use strict'; | ||
var information = _interopDefault(require('property-information')); | ||
var info = _interopDefault(require('property-information')); | ||
@@ -131,17 +131,17 @@ var ROOT_NODE = 'root'; | ||
var key = props[i]; | ||
var info = information(key) || { | ||
name: key, | ||
propertyName: key | ||
}; | ||
var name = info.name, | ||
propertyName = info.propertyName, | ||
mustUseAttribute = info.mustUseAttribute, | ||
mustUseProperty = info.mustUseProperty, | ||
boolean = info.boolean, | ||
overloadedBoolean = info.overloadedBoolean, | ||
commaSeparated = info.commaSeparated, | ||
spaceSeparated = info.spaceSeparated; | ||
var _ref = info.find(info.html, key) || { | ||
attribute: key, | ||
property: key | ||
}, | ||
attribute = _ref.attribute, | ||
property = _ref.property, | ||
mustUseAttribute = _ref.mustUseAttribute, | ||
mustUseProperty = _ref.mustUseProperty, | ||
boolean = _ref.boolean, | ||
booleanish = _ref.booleanish, | ||
overloadedBoolean = _ref.overloadedBoolean, | ||
commaSeparated = _ref.commaSeparated, | ||
spaceSeparated = _ref.spaceSeparated; | ||
var value = properties[key]; | ||
@@ -160,16 +160,20 @@ if (Array.isArray(value)) { | ||
if (mustUseProperty) { | ||
el[propertyName] = value; | ||
el[property] = value; | ||
} | ||
if (boolean || overloadedBoolean && typeof value === 'boolean') { | ||
if (value) { | ||
el.setAttribute(name, ''); | ||
el.setAttribute(attribute, ''); | ||
} else { | ||
el.removeAttribute(name); | ||
el.removeAttribute(attribute); | ||
} | ||
} else { | ||
el.setAttribute(name, value); | ||
} else if (booleanish) { | ||
el.setAttribute(attribute, value); | ||
} else if (value === true) { | ||
el.setAttribute(attribute, ''); | ||
} else if (value || value === 0 || value === '') { | ||
el.setAttribute(attribute, value); | ||
} | ||
} catch (e) { | ||
if (!mustUseAttribute && propertyName) { | ||
el[propertyName] = value; | ||
if (!mustUseAttribute && property) { | ||
el[property] = value; | ||
} | ||
@@ -176,0 +180,0 @@ // Otherwise silently ignore |
{ | ||
"name": "hast-util-to-dom", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Transform HAST to DOM", | ||
@@ -11,2 +11,3 @@ "main": "dist/hast-util-to-dom.js", | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"build": "rollup -c", | ||
@@ -22,3 +23,3 @@ "lint": "eslint .", | ||
"dependencies": { | ||
"property-information": "^3.2.0" | ||
"property-information": "^4.2.0" | ||
}, | ||
@@ -37,3 +38,3 @@ "devDependencies": { | ||
"glob": "^7.1.2", | ||
"hastscript": "^3.1.0", | ||
"hastscript": "^4.1.0", | ||
"jasmine-core": "^3.1.0", | ||
@@ -40,0 +41,0 @@ "jest-cli": "^23.1.0", |
@@ -72,5 +72,5 @@ # hast-util-to-dom [![Build Status][travis-badge]][travis] | ||
[travis-badge]: https://img.shields.io/travis/kmck/hast-util-to-dom.svg | ||
[travis-badge]: https://img.shields.io/travis/syntax-tree/hast-util-to-dom.svg | ||
[travis]: https://travis-ci.org/kmck/hast-util-to-dom | ||
[travis]: https://travis-ci.org/syntax-tree/hast-util-to-dom | ||
@@ -77,0 +77,0 @@ [yarn]: https://yarnpkg.com/lang/en/docs/install |
Sorry, the diff of this file is not supported yet
15245
340
+ Addedproperty-information@4.2.0(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedproperty-information@3.2.0(transitive)
Updatedproperty-information@^4.2.0