archives

« 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 15.10.4.1
http://es5.github.com/#x15.10.4.1

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

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

And,
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 15.10.4.1 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.