Caleb Porzio 3 år sedan
förälder
incheckning
970996472e

+ 1 - 3
packages/alpinejs/src/directives/x-html.js

@@ -7,9 +7,7 @@ directive('html', (el, { expression }, { effect, evaluateLater }) => {
 
     effect(() => {
         evaluate(value => {
-            mutateDom(() => {
-                el.innerHTML = value
-            })
+            el.innerHTML = value
         })
     })
 })

+ 9 - 0
tests/cypress/integration/directives/x-html.spec.js

@@ -24,5 +24,14 @@ test('sets html on update',
         get('button').click()
         get('h1').should(haveText('hey'))
     }
+)
+
+test('x-html allows alpine code within',
+    html`
+        <div x-data="{ foo: '<h1  x-text=&quot;bar&quot;></h1>', bar: 'baz' }" x-html="foo"></div>
+    `,
+    ({ get }) => {
+        get('h1').should(haveText('baz'))
+    }
 
 )