Skip to content

outerHTML throws TypeError: arr.forEach is not a function #95

Description

@virtualpatterns

I'm creating an Element using ...

let node = h('a', { 'attributes': { 'href': 'http:www.google.com' } }, 'Google')

... which is the style of hyperscript generated by html-to-hyperscript and html2hscript. When calling outerHTML on this Element ...

console.log(node.outerHTML)

... it throws ...

TypeError: arr.forEach is not a function
    at _stringify (/Volumes/DUMBLEDORE1/Users/fficnar/Projects/Shared Projects/mablung-pug/node_modules/html-element/index.js:291:9)
    at Element.outerHTML (/Volumes/DUMBLEDORE1/Users/fficnar/Projects/Shared Projects/mablung-pug/node_modules/html-element/index.js:336:48)
    at main (/Volumes/DUMBLEDORE1/Users/fficnar/Projects/Shared Projects/mablung-pug/source/sandbox/conv.js:24:22)
    at /Volumes/DUMBLEDORE1/Users/fficnar/Projects/Shared Projects/mablung-pug/source/sandbox/conv.js:32:1
    at ModuleJob.run (internal/modules/esm/module_job.js:140:23)
    at Loader.import (internal/modules/esm/loader.js:165:24)
    at Object.loadESM (internal/process/esm_loader.js:68:5)

Any ideas how to solve this? I suspect it's an html-element issue. If I change { 'attributes': { 'href': 'http:www.google.com' } } to { 'href': 'http:www.google.com' } it works ... but doesn't help since in my use the Element is automatically created from HTML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions