posthtml-component 1.0.0-RC.1 → 1.0.0-RC.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/process-attributes.js +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -76,7 +76,7 @@ module.exports = (options = {}) => tree => {
|
|
|
76
76
|
// Additional element attributes, in case already exist in valid-attributes.js it will replace all attributes
|
|
77
77
|
// It should be an object with key as tag name and as value a function modifier which receive
|
|
78
78
|
// the default attributes and return an array of attributes. Example:
|
|
79
|
-
// { TAG: (
|
|
79
|
+
// { TAG: (attributes) => { attributes[] = 'attribute-name'; return attributes; } }
|
|
80
80
|
options.elementAttributes = isPlainObject(options.elementAttributes) ? options.elementAttributes : {};
|
|
81
81
|
options.safelistAttributes = Array.isArray(options.safelistAttributes) ? options.safelistAttributes : [];
|
|
82
82
|
options.blacklistAttributes = Array.isArray(options.blacklistAttributes) ? options.blacklistAttributes : [];
|
|
@@ -52,7 +52,7 @@ module.exports = (currentNode, attributes, props, options, aware) => {
|
|
|
52
52
|
|
|
53
53
|
// Merge or override elementAttributes from options provided
|
|
54
54
|
if (!isEmpty(options.elementAttributes)) {
|
|
55
|
-
each(options.elementAttributes, (
|
|
55
|
+
each(options.elementAttributes, (modifier, tagName) => {
|
|
56
56
|
if (typeof modifier === 'function' && isString(tagName)) {
|
|
57
57
|
tagName = tagName.toUpperCase();
|
|
58
58
|
const attributes = modifier(validAttributes.elementAttributes[tagName]);
|