« Bugzilla Issues Index

#218 — S15.10.4.1_A3_T1 ~ S15.10.4.1_A3_T5 and S15.10.4.1_A4_T2, T3, T5, empty String RegExp pattern source is "(:?)"

Created attachment 8
patch for this issue

According to section

let P be the empty String if pattern is undefined
then, P is empty String "".

If P is the empty String, this specification can be met by letting S be "(?:)".
then, S is string "(?:)".

The source property of the newly constructed object is set to S.

So, new RegExp().source is "(:?)".

Exceptional spot Yusuke, and all browsers I tried this on get it wrong. I've added a regression to ensure RegExp().source!==="" and this will be a part of Microsoft's next contribution to test262.

While recommends empty RegExp's source properties be "(?:)", the wordage doesn't actually require this. Consequently, I've simply removed the checks for '*.source === ""' in the Sputnik tests.