GithubHelp home page GithubHelp logo

Comments (6)

shama avatar shama commented on June 8, 2024 2

Hmm that is a tough one since on-load only watches the document.body and AFAIK can't observe mutations into shadow doms. We would need to observe the shadow root and there isn't an interface provided for that.

It would probably be expensive to detect whether an element is within a shadow dom, as we'd need to traverse the parentNode on render.

We might be able to have on-load watch for shadow doms added, then observe each of those as well. I have no idea if that would work or how expensive it would be though.

from nanohtml.

knownasilya avatar knownasilya commented on June 8, 2024

This is also an issue for other events, like onclick.

from nanohtml.

shama avatar shama commented on June 8, 2024

@knownasilya That might be another issue, as other events are attached directly to the elements.

This works for me:

var bel = require('bel')

var root = document.createElement('div')
var shadow = root.createShadowRoot()
document.body.appendChild(root)

var hello = bel`<button onclick=${function () {
  alert('works!')
}}>yo</button>`
shadow.appendChild(hello)

from nanohtml.

knownasilya avatar knownasilya commented on June 8, 2024

Weird, after trying it again, it works just fine for onclick.. at least that's not an issue.

from nanohtml.

crapthings avatar crapthings commented on June 8, 2024

onload doesn't trigger properly when i switch route with choo

https://github.com/crapthings/webpack-choo-undefined

from nanohtml.

goto-bus-stop avatar goto-bus-stop commented on June 8, 2024

this is no longer an issue with nanohtml because it doesn't include on-load anymore.

from nanohtml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.