Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

Attribute value should be re-encoded in outerHTML #139

Open
treshugart opened this issue Nov 14, 2016 · 0 comments
Open

Attribute value should be re-encoded in outerHTML #139

treshugart opened this issue Nov 14, 2016 · 0 comments
Assignees
Labels

Comments

@treshugart
Copy link
Member

Browsers seem to consistently report outerHTML / innerHTML between vendors but have odd behaviour when inspecting the values. For example:

const div = document.createElement('div');
div.innerHTML = '<div test="&quot;test1 &amp; test2&quot;">&quot;test1 &amp; test2&quot;</div>';
console.log(div.outerHTML);
console.log(div.innerHTML);
console.log(div.getAttribute('test');
console.log(div.firstChild.outerHTML);
console.log(div.firstChild.innerHTML);
console.log(div.firstChild.getAttribute('test');

To be consistent with their inconsistencies, we need to make outerHTML encode the values that it uses to serialise the attributes using node.value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants