com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

Test failures on Scala.js 0.6.13 with node.js #143

Closed larsrh closed 3 years ago

larsrh commented 8 years ago

Happens only with the default JSEnv, but not with jsEnv := PhantomJSEnv().value.

[info] Failures:
[info] 21/104  scalatags.jsdom.BasicTests.rawAttrs
[info]                  scala.scalajs.js.JavaScriptException: TypeError: e.children[0].attributes[0].cloneNode is not a function
[info] nr.yq(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:240:263)
[info] nr.zq(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:240:38)
[info] Pr.c.We(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:731:476)
[info] Nb(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:18:378)
[info] wA(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:869:374)
[info] ic.c.y(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:868:419)
[info] ic.lc.toString(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:21:46)
[info] ka(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:4:243)
[info] xi(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:101:244)
[info] {anonymous}()(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:491:324)
[info] 15/23   scalatags.jsdom.ExampleTests.properEscaping
[info]                          java.lang.AssertionError: assertion failed
[info] hp.pt.ap(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:306:201)
[info] hp.pt.xc(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:316:200)
[info] hp.p(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:439:365)
[info] zi(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:392:66)
[info] xi(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:101:228)
[info] {anonymous}()(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:545:171)
[info] Ux.va(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:417:223)
[info] lk(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:121:344)
[info] lk(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:121:310)
[info] aB.s(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:650:90)
[info] 16/23   scalatags.jsdom.ExampleTests.unsanitizedInput
[info]                          scala.scalajs.js.JavaScriptException: NoModificationAllowedError
[info] HTMLBodyElementImpl.insertAdjacentHTML(/home/lars/proj/lihaoyi/scalatags/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:430:13)
[info] HTMLBodyElement.insertAdjacentHTML(/home/lars/proj/lihaoyi/scalatags/node_modules/jsdom/lib/jsdom/living/generated/Element.js:359:40)
[info] tz.c.Wj(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:727:134)
[info] tz.c.We(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:727:197)
[info] Nb(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:18:378)
[info] wA(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:869:374)
[info] ic.c.sm(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:868:505)
[info] ic.c.We(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:868:475)
[info] Nb(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:18:378)
[info] wA(/home/lars/proj/lihaoyi/scalatags/scalatags/js/target/scala-2.11/scalatags-test-opt.js:869:374)
sjrd commented 8 years ago

For the first one: Attr.cloneNode() is deprecated. See https://developer.mozilla.org/en-US/docs/Web/API/Attr#Deprecated_properties_and_methods I expect it therefore has not been implemented in jsdom. The test is therefore obsolete and should probably be removed.

cloneNode() You shouldn't have been using this in the first place, so you probably don't care that this is going away.

lulz :P

I did not investigate the other two failures, but I wouldn't be surprised if they have a similar cause. I would expect jsdom to be much stricter wrt. deprecated DOM APIs than browsers (the latter have to stay backward compatible for loong time).

larsrh commented 8 years ago

@sjrd Thanks for the investigation. Unfortunately I can't really do much about this, because my knowledge about Scala.js is approximately zero. I'm just trying to help @lihaoyi to get some 2.12 builds out the door, because many things depend on it :smile:

lihaoyi commented 8 years ago

FWIW, I'd say "works on PhantomJS" is good enough for me and you can go ahead with publishing if the tests pass there. We can sort out the deprecated tests and stuff later