@riotjs/dom-bindings
Advanced tools
Comparing version 9.0.3 to 9.0.4
@@ -487,2 +487,3 @@ import { insertBefore, removeChild, replaceChild, cleanNode, moveChildren, clearChildren } from '@riotjs/util/dom'; | ||
/* c8 ignore next */ | ||
const ElementProto = typeof Element === 'undefined' ? {} : Element.prototype; | ||
@@ -500,4 +501,4 @@ const isNativeHtmlProperty = memoize( | ||
function setAllAttributes(node, attributes) { | ||
Object.entries(attributes).forEach(([name, value]) => | ||
attributeExpression(node, { name }, value), | ||
Object.keys(attributes).forEach((name) => | ||
attributeExpression(node, { name }, attributes[name]), | ||
); | ||
@@ -664,12 +665,3 @@ } | ||
const getTextNode = (node, childNodeIndex) => { | ||
const target = node.childNodes[childNodeIndex]; | ||
if (target.nodeType === Node.COMMENT_NODE) { | ||
const textNode = document.createTextNode(''); | ||
node.replaceChild(textNode, target); | ||
return textNode | ||
} | ||
return target | ||
return node.childNodes[childNodeIndex] | ||
}; | ||
@@ -798,8 +790,6 @@ | ||
function create$3(node, { expressions }) { | ||
return { | ||
...flattenCollectionMethods( | ||
expressions.map((expression) => create$4(node, expression)), | ||
['mount', 'update', 'unmount'], | ||
), | ||
} | ||
return flattenCollectionMethods( | ||
expressions.map((expression) => create$4(node, expression)), | ||
['mount', 'update', 'unmount'], | ||
) | ||
} | ||
@@ -806,0 +796,0 @@ |
{ | ||
"name": "@riotjs/dom-bindings", | ||
"version": "9.0.3", | ||
"version": "9.0.4", | ||
"description": "Riot.js DOM bindings", | ||
@@ -53,21 +53,21 @@ "main": "dist/dom-bindings.cjs", | ||
"@riotjs/prettier-config": "^1.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.1", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"benchmark": "^2.1.4", | ||
"c8": "^8.0.1", | ||
"chai": "^4.3.8", | ||
"c8": "^9.1.0", | ||
"chai": "^4.4.1", | ||
"coveralls": "^3.1.1", | ||
"eslint": "^8.48.0", | ||
"eslint-config-riot": "^4.1.1", | ||
"jsdom": "^22.1.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-riot": "^4.1.2", | ||
"jsdom": "^24.0.0", | ||
"jsdom-global": "3.0.2", | ||
"mocha": "^10.2.0", | ||
"prettier": "^3.0.2", | ||
"rollup": "^3.28.1", | ||
"sinon": "^15.2.0", | ||
"mocha": "^10.3.0", | ||
"prettier": "^3.2.5", | ||
"rollup": "^4.12.0", | ||
"sinon": "^17.0.1", | ||
"sinon-chai": "^3.7.0", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"@riotjs/util": "^2.2.2" | ||
"@riotjs/util": "^2.2.4" | ||
} | ||
} |
@@ -16,3 +16,3 @@ # dom-bindings | ||
// Create the app template | ||
const tmpl = template('<p><!----></p>', [ | ||
const tmpl = template('<p> </p>', [ | ||
{ | ||
@@ -64,3 +64,3 @@ selector: 'p', | ||
```js | ||
const tmpl = template('<p><!----></p>', [ | ||
const tmpl = template('<p> </p>', [ | ||
{ | ||
@@ -154,7 +154,7 @@ selector: 'p', | ||
template('<article><p><!----></p></article>', [pGreetingBinding]) | ||
template('<article><p> </p></article>', [pGreetingBinding]) | ||
``` | ||
In this case we have created a binding to update only the content of a `p` tag.<br/> | ||
_Notice that the `p` tag has an empty comment that will be replaced with the value of the binding expression whenever the template will be mounted_ | ||
_Notice that the `p` tag has an empty text node that will be replaced with the value of the binding expression whenever the template will be mounted_ | ||
@@ -235,6 +235,3 @@ </details> | ||
```html | ||
<p> | ||
<b>Your name is:</b><i>user_icon</i | ||
><!----> | ||
</p> | ||
<p><b>Your name is:</b><i>user_icon</i></p> | ||
``` | ||
@@ -304,3 +301,3 @@ | ||
evaluate: scope => scope.items, | ||
template: template('<!---->', [{ | ||
template: template(' ', [{ | ||
expressions: [ | ||
@@ -347,3 +344,3 @@ { | ||
selector: 'b' | ||
template: template('<!---->', [{ | ||
template: template(' ', [{ | ||
expressions: [ | ||
@@ -401,3 +398,3 @@ { | ||
return template('<!---->', [ | ||
return template(' ', [ | ||
{ | ||
@@ -490,3 +487,3 @@ expressions: [ | ||
], | ||
html: '<p expr1><!----></p>', | ||
html: '<p expr1> </p>', | ||
}, | ||
@@ -493,0 +490,0 @@ ] |
@@ -5,8 +5,6 @@ import createExpression from '../expression.js' | ||
export default function create(node, { expressions }) { | ||
return { | ||
...flattenCollectionMethods( | ||
expressions.map((expression) => createExpression(node, expression)), | ||
['mount', 'update', 'unmount'], | ||
), | ||
} | ||
return flattenCollectionMethods( | ||
expressions.map((expression) => createExpression(node, expression)), | ||
['mount', 'update', 'unmount'], | ||
) | ||
} |
@@ -8,2 +8,3 @@ import { | ||
/* c8 ignore next */ | ||
const ElementProto = typeof Element === 'undefined' ? {} : Element.prototype | ||
@@ -21,4 +22,4 @@ const isNativeHtmlProperty = memoize( | ||
function setAllAttributes(node, attributes) { | ||
Object.entries(attributes).forEach(([name, value]) => | ||
attributeExpression(node, { name }, value), | ||
Object.keys(attributes).forEach((name) => | ||
attributeExpression(node, { name }, attributes[name]), | ||
) | ||
@@ -25,0 +26,0 @@ } |
@@ -10,12 +10,3 @@ import normalizeStringValue from '../util/normalize-string-value.js' | ||
export const getTextNode = (node, childNodeIndex) => { | ||
const target = node.childNodes[childNodeIndex] | ||
if (target.nodeType === Node.COMMENT_NODE) { | ||
const textNode = document.createTextNode('') | ||
node.replaceChild(textNode, target) | ||
return textNode | ||
} | ||
return target | ||
return node.childNodes[childNodeIndex] | ||
} | ||
@@ -22,0 +13,0 @@ |
@@ -11,3 +11,3 @@ /** | ||
* .template( | ||
* `<div expr0><!----></div><div><p expr1><!----><section expr2></section></p>`, | ||
* `<div expr0> </div><div><p expr1> <section expr2></section></p>`, | ||
* [ | ||
@@ -14,0 +14,0 @@ * { |
Sorry, the diff of this file is not supported yet
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
153886
3959
586
Updated@riotjs/util@^2.2.4