lampepfl/scala-js — pull request #28 by lihaoyi (2013-11-03 23:48:08+00:00)
Title: made (a: A).isInstanceOf[B] work sensibly for A <: js.Any and B <: js.Any, 

We check for primitive types using `typeof` before falling back to `instanceof` for objects. Comparing between A <: js.Any and B !<: js.Any still throws a compile error, which I think is reasonable. I think this should catch everything, since most people should be using normal `.prototype` inheritance and `instanceof` should work.

For example, this works now:
```scala
package helloworld

import scala.scalajs.js
import js.annotation.JSName

@JSName("ClassC")
class C(x: js.Number) extends js.Object

object HelloWorld {
def main() {
val num: js.Number = 1
val str: js.String = ""
val c = new C(num)
println(num.isInstanceOf[js.Number]) // true
println(str.isInstanceOf[js.Number]) // false
println(str.isInstanceOf[js.String]) // true
println(c.isInstanceOf[js.String]) // false
println(c.isInstanceOf[js.RegExp]) // false
println(c.isInstanceOf[C]) // true
println(str.isInstanceOf[C]) // false
println(c.isInstanceOf[js.Object]) // true

}
}
```