« Bugzilla Issues Index

#462 — String.prototype HTML methods in Annex B should probably call CheckObjectCoercible()

I’ve previously made an attempt at defining these methods here:

It would make sense to have these methods call the CheckObjectCoercible() abstract operation on the `this` object, so that they cannot be applied to `null` or `undefined`, just like the other String.prototype methods.

The majority of the engines I tested in implement it like this, with no compatibility issues: Firefox/Spidermonkey, Safari/JavaScriptCore, and Opera/Carakan.

Chrome/V8 and IE/Chakra are the only engines I tested that don’t currently perform the CheckObjectCoercible() step. Here are some relevant bugs:

* Safari/JavaScriptCore: (old bug from last year)
* Chrome/V8:
* IE/Chakra:

It would improve interoperability and consistency within the spec if ES6 could define these methods with something like `CheckObjectCoercible(this)` as their first step. Please consider doing so.

Tests for these methods as defined on (i.e. including the CheckObjectCoercible step) can be found here:

That check is already there. It is step 1 of the abstract operation CreateHTML