raquo / snabbdom.scala Goto Github PK
View Code? Open in Web Editor NEWVirtual DOM for Scala.js based on Snabbdom.js
License: MIT License
Virtual DOM for Scala.js based on Snabbdom.js
License: MIT License
Selenium is slower than JSDom but provides a real browser with a real DOM, an environment much closer to where your code will actually run.
There are some commented rambles in build.sbt, but I was so far unable to get this to work. I think we need this scalajs-bundler ticket addressed to get this to work. scalacenter/scalajs-bundler#89
The short example is not working,the symbol := and lots of other things are undefined,do i have to add some other dependencies or the api is changed?
This is only happening in JSDom (not in real browser DOM) because of a bug in JSDom. Given my lack of time in the foreseeable future I don't think I can fix this any time soon.
JSDom bug report: jsdom/jsdom#1745
Seems like someone has already started on a fix: jsdom/jsdom#1751
Other than fixing JSDom, we could set up the tests to be run in Selenium instead, where real DOM is used. There's an issue for that as well: #2
Our hooks have correct types except for one edge case, when the hooks for the initial app container are processed. Snabbdom creates a virtual empty node for the first argument of patch
method when it's a real DOM element, and that empty virtual node is not an instance of our own Node class but a plain JS object which although has a similar shape will be missing any additional fields and methods defined in Scala. This is especially a problem for libraries based on Snabbdom.scala that subclass Node and NodeData.
There are a couple ways to fix that. One is to make the types reflect this reality. Another is to keep current types but avoid calling Scala-provided hook on the snabbdom-created node in that edge case.
I kinda favour the latter option because we will probably not lose anything of significance, but it would be a departure from Snabbdom.js API, so needs to be considered more carefully. Which is why this is not yet resolved.
For anyone wondering what's happening with this project:
Since I originally wrote Snabbdom.scala I have been busy working on other Scala.js DOM-related projects. To minimize redundancy in all those projects, I have extracted parts of Snabbdom.scala into more generic packages โ Scala DOM Types and Scala DOM TestUtils.
I am currently working on migrating Snabbdom.scala to use these libraries. Once that is done I will publish version 0.1 of Snabbdom.scala to Maven Central. If you want to get notified when that happens you can watch this project on github, or subscribe to this specific issue.
Hi,
I'm currently migrating a snabbdom project to snabbdom.scala. I found an issue with svgs. Maybe you can supply a solution to that problem:
snabbdom does some magic in it's h
-function, that sets the namespace for svg elements. See: https://github.com/snabbdom/snabbdom/blob/v0.7.3/src/h.ts#L42
As far as I know, snabbdom.scala doesn't use that function so the namespace won't be set. Without the namespace, I can't set some attributes (like viewBox
) as the xml relies on case sensitivity and normal html elements are case insensitive.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.