Skip to content

IE8: document.createElement creates HTML5 elements without HTML namespace #54

@jamesreggio

Description

@jamesreggio

Execute in IE8:

n = document.createElement('nav');
console.log(n.outerHTML);
// <:nav></:nav>

n = document.createElement('NAV');
console.log(n.outerHTML);
// <NAV></NAV>

The latter result is desirable; the former, undesirable. Further inspection shows that the former element has an empty scopeName, whereas the latter has HTML for its scopeName.

This seems to be an issue with calling cloneNode() on the cached copy of the nav element. cloneNode() inexplicably loses the namespace in IE8 (and I can't seem to find documentation showing that this is by design). Making the tag name all-caps bypasses the cache and produces the correct result.

I tried going through the blame/history to see when this issue may have been introduced, but it seems to have been around for a while...

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