Add feature "innerHTML" to Element class
Specification
- pywebview version: 5.1
- operating system: all
- web renderer: Chromium
Add innerHTML to Element
Hi, it would be useful to add innerHTML getter / setter to Element class. It is often used in frontend development and in my opinion it is more useful then "text" currently implemented.
Practicalities
-
YES I am willing to work on this issue myself.
-
NO I am prepared to support this issue financially.
This monkey patch works just fine:
from webview.dom.element import Element
@property
def inner_html(self) -> str:
return self._window.evaluate_js(f"{self._query_command}; element.innerHTML")
@inner_html.setter
def inner_html(self, html: str) -> None:
self._window.evaluate_js(f"""{self._query_command}; element.innerHTML = `{html}`""")
Element.inner_html = inner_html
Yes, why not. I suggest to use html instead of inner_html though.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The message to post on the issue when closing it. If none provided, will not comment when closing an issue.