Elements missing outerHTML
See original GitHub issueBecause toString()
on an element in the browser returns something like “[object HTMLDivElement]”, I have a helper function like this in my tests that run on both server and browser:
function toStr (el) {
return el.outerHTML || String(el);
}
Could elements in min-document have an outerHTML as well for parity?
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Element.outerHTML - Web APIs - MDN Web Docs
The outerHTML attribute of the Element DOM interface gets the serialized HTML fragment describing the element including its descendants.
Read more >returning element altered by outerHTML - Stack Overflow
What you'll notice is that the reference is to the original element, after outerHTML is used. This is as stated in the documentation:....
Read more >Property 'outerHTML' missing from 'Element' #14667 - GitHub
MDN claims it exists on Element https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML. It is missing from lib.dom.d.ts .
Read more >outerHTML in the JavaScript DOM - YouTube
The Element. outerHTML property of the Document Object Model allows you to both set and get the outerHTML of an Element.
Read more >outerHTML jQuery Plugin - CSS-Tricks
innerHTML () is native and returns the contents of a DOM node (e.g. I live inside a div.. outerHTML() is not, which would...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would also like support for
outerHTML
so the exact same code can run client/server.This seems like a good use for a getter in the constructor to so I’m curious why you want to avoid it:
Otherwise this lib would have to monitor changes to itself and render upon each to the property; which sounds a lot more horrible IMO.
Thanks for the clarification 👍