Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.24 KB

README.md

File metadata and controls

59 lines (39 loc) · 1.24 KB

Jsdom API for Scala.js

jsdom - A JavaScript implementation of the DOM and HTML standards.

Description

A JavaScript implementation of the DOM and HTML standards

Build Dependencies

Build/publish the SDK locally

$ sbt clean publish-local

Running the tests

Before running the tests the first time, you must ensure the npm packages are installed:

$ npm install

Then you can run the tests:

$ sbt test

Examples

import io.scalajs.dom.html.HTMLAnchorElement
import io.scalajs.npm.jsdom._

val doc = JsDom.jsdom("""<p id="p1"><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom!</a></p>""")
val elem = doc.getElementsByClassName("the-link").headOption.orNull
assert(elem != null)

val text = elem.asInstanceOf[HTMLAnchorElement].text
assert(text == "jsdom!")

Artifacts and Resolvers

To add the Jsdom binding to your project, add the following to your build.sbt:

libraryDependencies += "io.scalajs.npm" %%% "jsdom" % "0.5.0"

Optionally, you may add the Sonatype Repository resolver:

resolvers += Resolver.sonatypeRepo("releases")