Re: [whatwg/dom] Make element and attribute names behave like the HTML parser (#449)

My $0.02, I think you do want createElementNS to use the HTML rules for local names in the HTML namespace. Why? It would be good if there's one line of code authors can reliably use to duplicate an element. I think that line has to be:

    document.createElementNS(
        element.namespaceURI,
        `${element.prefix}:${element.localName}`,
        magic(element));

(OK three lines. And a function, "magic", which somehow detects autonomous built-in elements and produces a dictionary with 'is' for them.)

Maybe validate and extract step 5 should specify that it splits on the *first* colon. Since `:foo` would not be a valid local name any more, validate and extract may want to map the empty string prefix to null so that the checks in step 6 work.

If you make the local name checks consistent with createElement's then that line of code should be sufficient for duplicating an element, whether it is HTML, SVG or vanilla.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/449#issuecomment-297584771

Received on Thursday, 27 April 2017 01:21:17 UTC