question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Children appended to script element when using root: document.body

See original GitHub issue

Hi,

When I specify root: document.body I get children of my component appended to the script tag:

image

Code

View

const { h } = require('hyperapp')
const hyperx = require('hyperx')

const html = hyperx(h)

const ScheduleEvent = (event) => html`
<li class="schedule-event">
  <span class="event">${event.title}</span>
  <span class="hours">
    <time>${event.start}</time> - 
    <time>${event.end}</time>
  </span>
</li>
`

const ScheduleDay = (day) => html`
<li class="schedule-day">
  <span class="day"></span>
  <ul class="events">
    ${day.events.map(event => ScheduleEvent(event))}
  </ul>
</li>
`

const ScheduleWidget = (schedule) => html`
<ul class="schedule-widget">
  ${schedule.days.map(day => ScheduleDay(day))}
</ul>
`

module.exports = ScheduleWidget

Index

const { app } = require('hyperapp')

const model = require('./lib/model')
const view = require('./lib/view')
const reducers = require('./lib/reducers')
const subscriptions = require('./lib/subscriptions')

app({ model, view, reducers, subscriptions, root: document.body })

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
jorgebucarancommented, Mar 7, 2017

Fixed. 🤣

1reaction
ngrymancommented, Mar 7, 2017

@jbucaran Couldn’t it be related to the hardcoded 0 at app.js:L:116 patch(root, node, node = view(model, actions), 0)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.appendChild() - Web APIs - MDN Web Docs
The appendChild() method of the Node interface adds a node to the end of the list of children of a specified parent node....
Read more >
JavaScript appendchild(): What it is and when to use it - Flexiple
The JavaScript appendChild() method is used to insert a new node or reposition an existing node as the last child of a particular...
Read more >
javascript - How to target document.body.appendchild(' to root ...
Show activity on this post. parent to get window object of document where iframe is located, then get document and then actual DOM...
Read more >
JavaScript appendChild() By Practical Examples
In this tutorial, you will learn how to use the JavaScript appendChild() method to add a node to the end ... The appendChild()...
Read more >
Children appended to shadow root of custom element does ...
The issue is that children (style element in this case) appended to shadow root of custom element does not get onload event fired....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found