Code Monkey home page Code Monkey logo

Comments (14)

mathiasbynens avatar mathiasbynens commented on July 28, 2024

I think @allenwb meant the RegExp u flag. AFAIK there is no such thing as the h flag.

from compat-table.

allenwb avatar allenwb commented on July 28, 2024

right "u". Full Unicode RegExp matching semantics.

Keyboard proximity error...

from compat-table.

webbedspace avatar webbedspace commented on July 28, 2024

A recent commit by me (that has already been merged) has implemented the @@hasInstance and @@toPrimitive tests.

from compat-table.

kangax avatar kangax commented on July 28, 2024

@webbedspace thanks, checked

from compat-table.

webbedspace avatar webbedspace commented on July 28, 2024

@@create has already been removed now as per recent spec updates.

from compat-table.

Yaffle avatar Yaffle commented on July 28, 2024

@webbedspace , but [[CreateAction]] was added instead

from compat-table.

Yaffle avatar Yaffle commented on July 28, 2024

it is a little hard to understand from the spec, how subclassing should work, but seems, subclassing will work only for class AbortablePromise extends Promise, not for inheritance we can use in ES5...

from compat-table.

webbedspace avatar webbedspace commented on July 28, 2024

[[CreateAction]] is not directly observable to userland code (unlike @@create), so adding a test for it seems both improper and difficult. The subclassing checks should instead suffice.

from compat-table.

allenwb avatar allenwb commented on July 28, 2024

Yes, [[CreateAction]] is only "inherited" via class definitions. But subclassability of all built-ins that have [[CreateAction]]'s should be tested. For example,
class MyArray extends Array {};
class MyDate extends Date {};
etc.

In each case, the special instance behaviors provided by the super class' [[CreateAction]] should be observably present on instances of the subclass. EG,

   let ma = new MyArray;
   ma[3]='three';
   assert(ma.length === 4);

from compat-table.

webbedspace avatar webbedspace commented on July 28, 2024

So, testing subclassability will mean applying the following checks to instances of the subclasses:

  • Array: Dynamic .length behaviour
  • RegExp: Can be used in String#match, I guess.
  • Function: Can be successfully called and newed.
  • Date: ???
  • String: instance == a primitive with the same value.
  • Number: instance == a primitive with the same value.
  • Boolean: instance == a primitive with the same value.
  • Promise: instance's resolving function is called when resolved.
  • Proxy (i.e. the Proxy constructor): ??? (is this possible?)
  • Error: ???
  • Map: .set() works
  • Set: .add() works
  • WeakMap, WeakSet: ??? (Since WeakMap's GC behaviour is not observable, it's questionable whether this can be distinguished from Map and Set's tests.)

Additionally, the constructors need these tests:

  • Array: .of() and .from() return instances of the subclass (already included in compat table) as well as .slice()
  • Function: ???
  • Promise: .resolve() and .reject() return instances of the subclass

(I'll need some more research to complete this list.)

from compat-table.

kangax avatar kangax commented on July 28, 2024

I was just about to add .length behavior, since our current test "extends (built-in constructors)" is a bit misleading in regards to at least IETP (which doesn't update length) as I noticed couple days ago.

from compat-table.

webbedspace avatar webbedspace commented on July 28, 2024

The main reason I split the extends test is because TypeScript and Closure have specific demands about what can be in the extends clause. The point of that test isn't to check that the instance has correct behaviour, but that the extends clause is accepted at all. So, I guess something like String should be put there instead of Array.

from compat-table.

kangax avatar kangax commented on July 28, 2024

I figured. We can maybe just leave that one as is (it'll be — "extends built-in constructors, basic") and add behavioral ones on top. Or add all of the above tests under that one? Would that be too much? Do we need a separate test, not just sub-test for it?

from compat-table.

kangax avatar kangax commented on July 28, 2024

Implemented by @webbedspace recently so closing

from compat-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.