Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Element innerHTML for IE11 #471

Open
kapouer opened this issue Feb 18, 2020 · 4 comments
Open

Feature request: Element innerHTML for IE11 #471

kapouer opened this issue Feb 18, 2020 · 4 comments
Labels
feature New feature request library Relates to an Origami library

Comments

@kapouer
Copy link
Contributor

kapouer commented Feb 18, 2020

I recently found out that IE11 has HTMLElement innerHTML get and set:

Object.getOwnPropertyDescriptor(
  HTMLElement.prototype,
  'innerHTML'
);

but not Element.prototype:
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML

@origamiserviceuser origamiserviceuser added this to incoming in Origami ✨ Feb 18, 2020
@JakeChampion
Copy link
Owner

This states that IE 4 and above have Element.prototype.innerHTML -- https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#Browser_compatibility

@kapouer
Copy link
Contributor Author

kapouer commented Feb 18, 2020

In real IE11, tested on about:blank

Object.getOwnPropertyDescriptor(
 Element.prototype,
 'innerHTML'
);
undefined

I suppose the problem is getOwnPropertyDescriptor, then ? But what would be the correct way to obtain the descriptor ?

@kapouer
Copy link
Contributor Author

kapouer commented Feb 18, 2020

Found out more info from this forum, to sum it up:

Microsoft created innerHTML, and the other browsers picked it up.

In IE, innerHTML doesn't behave the same was as in Firefox or Chrome. I was trying to mitigate that by modifying innerHTML directly.

For IE10, Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML") was working, but Object.getOwnPropertyDescriptor(HTMLElement.prototype, "innerHTML") was not. (I think)
For IE11 it is the exact opposite..!

EDIT: IE10 behaves the same as IE11 (HTMLElement works, not Element)
EDIT2: other browsers return undefined for Object.getOwnPropertyDescriptor(HTMLElement.prototype, "innerHTML")

@kapouer
Copy link
Contributor Author

kapouer commented Feb 19, 2020

if (!Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML')) {
  Object.defineProperty(
    Element.prototype,
    'innerHTML',
    Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML')
  );
  // but here HTMLElement should not have a innerHTML property, how to remove it ?
}

@JakeChampion JakeChampion added feature New feature request library Relates to an Origami library labels Mar 24, 2020
@robertboulton robertboulton removed this from Backlog in Origami ✨ Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request library Relates to an Origami library
Projects
None yet
Development

No branches or pull requests

2 participants