LeaVerou / md-block

A custom element for rendering stylable (light DOM) Markdown

Home Page:https://md-block.verou.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to handle textContent?

LeaVerou opened this issue · comments

Right now, textContent doesn't do anything special, and one needs to use mdContent to re-render Markdown on the component.
However, that means that <md-block> doesn't work well with libraries that handle HTML in an agnostic way (e.g. Mavo, Vue, Angular etc).
However, if textContent (and innerText?) becomes an alias to mdContent, then how does one get the actual textContent of the element?

Another alternative would be if textContent sets mdContent on write, but returns the actual element textContent on read. This would allow libraries that work with textContent to update its content, but reading textContent would still work.
Is there any precedent for such behavior? Is it confusing?