We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c90ad29 commit f13dac5Copy full SHA for f13dac5
README.md
@@ -117,6 +117,19 @@ var el = html`
117
document.querySelector('ul').appendChild(el)
118
```
119
120
+### Conditional attributes
121
+
122
+Use a javascript object to conditionally add HTML attributes.
123
124
+```js
125
+var html = require('nanohtml')
126
127
+var customAttr = isFuzzy ? { 'data-hand-feel': 'super-fuzzy' } : {}
128
+var el = html`
129
+ <div ${ customAttr }></div>
130
+`
131
+```
132
133
## Static optimizations
134
Parsing HTML has significant overhead. Being able to parse HTML statically,
135
ahead of time can speed up rendering to be about twice as fast.
0 commit comments