HTML extensions to String.prototype must throw an error if the `this` object is not coercible (i.e. `null` or `undefined`) - by MathiasBynens

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


ID 752807 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/8/2012 4:45:50 AM
Access Restriction Public

Description

Spec: http://mathias.html5.org/specs/javascript/#string

Note that the first step of all these methods is:

1. Call CheckObjectCoercible(this).

Chakra doesn’t currently perform this step. For example:

    String.prototype.anchor.call(undefined); // should throw a TypeError, but doesn’t in Chakra
    String.prototype.anchor.call(null); // should throw a TypeError, but doesn’t in Chakra

Here’s a list of the methods that have this issue:

* String.prototype.anchor(name)
* String.prototype.big()
* String.prototype.blink()
* String.prototype.bold()
* String.prototype.fixed()
* String.prototype.fontcolor(color)
* String.prototype.fontsize(size)
* String.prototype.italics()
* String.prototype.link(href)
* String.prototype.small()
* String.prototype.strike()
* String.prototype.sub()
* String.prototype.substr(start, length)
* String.prototype.sup()

Tests: http://mathias.html5.org/tests/javascript/string/ (Note: some of these tests fail because of separate issues, reported here previously.)

Please consider fixing this to improve interoperability with Safari/JavaScriptCore, Opera/Carakan and Firefox/Spidermonkey.
Sign in to post a comment.
Posted by Microsoft on 7/17/2013 at 10:20 AM
Thank you for your feedback.

The issue you are reporting is by design.

Best regards,

The Internet Explorer Team
Posted by Microsoft on 7/9/2012 at 10:32 AM
Thank you for your feedback. We will be investigating this issue further.

Best regards,

The Internet Explorer Team