Skip to content

Exceptions thrown when setting Element's innerHTML or innerText with non-string value #308

Description

@chirsz-ever

Reproduciable example:

import { parseHTML } from 'linkedom';

const window = parseHTML('<!DOCTYPE html><html><head></head><body></body></html>');

// These are OK:
// window.document.body.innerHTML = '1';
// window.document.body.innerText = '1';

// These are not:
window.document.body.innerHTML = 1;
window.document.body.innerText = 1;

The behavior tested on the browser seems to be consistent with

set innerHTML(value) {
  internalSetInnerHTMLWithString(this, value === null ? '' : String(value));
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions