Skip to content

A JavaScript implementation of the DOM and HTML standards

License

Notifications You must be signed in to change notification settings

scalajs-io/jsdom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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="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/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") 

Releases

No releases published

Packages

No packages published