ECMAScriptの仕様では、0x0A/0x0D以外にU+2028/2029の文字も改行とすることが明記されています。 これはあまり知られていないように思います。 以下はアラートを出します。 <script> //[U+2028]alert(1) </script> 知られていないだけでなく、知っていたとしても、スクリプトで文字列を処理するときに、U+2028/2029まで考慮する開発者がどれだけいるのかという話です。 実際、U+2028/2029を放り込むと文字列リテラル内にその文字が生のまま配置され、エラーが出るページは本当にたくさんあります。まあ、エラーがでるだけなら、大抵の場合大きな問題にはなりません。 ところが、U+2028/2029によってXSSが引き起こされてしまう場合というのを最近実際に見ました。 Googleのサービスで見つけた2つのケースを取り上げたいと思います。 ケ
One of the most interesting new parts of ECMAScript 6 are arrow functions. Arrow functions are, as the name suggests, functions defined with a new syntax that uses an “arrow” (=>) as part of the syntax. However, arrow functions behave differently than traditional JavaScript functions in a number of important ways: Lexical this binding – The value of this inside of the function is determined by whe
If you have ever tried to write an application that supports multiple languages, I’m sure you will agree that it can be a complicated process. While there are obvious issues, such as translating the text, there are also differing conventions between countries on how things like dates and numbers are formatted, or how letters are sorted. Even just between the different versions of English, there ar
904701 - Implement prototype madness for ES6 generators Firefox 26 (Nightly) で function * () { yield ... } な ECMAScript 6th にある Generator の構文が導入された。 ということで、やる気を出して、チョコチョコと調査。 まず、用語の定義 GeneratorFunctionインスタンス function *() { yield "OK"; } の様な関数オブジェクト GeneratorObject GeneratorFunctionから生成されたインスタンスオブジェクト [[prototype]] オブジェクトのプロトタイプチェーンとなる内部プロパティ // GeneratorFunction function * geneFunc () { yield "OK"
番組の報告 この番組を通報する理由を選んでください。ご報告いただいた内容は48時間以内に確認させていただきます。 お客様が著作権者、またはその代理人としての権限を与えられているか、著作権に基づく独占権により行動する権限を与えられている場合は、著作権ポリシーから申告をご提出ください。
概要 正規表現でドット「.」を改行文字にもマッチさせることができるようになった。 続きを読む 概要 try { } catch( err ) { }の( err )の部分を省略することができるようになった。 続きを読む 概要 正規表現内の好きな部分に名前を付け、その名前を使ってマッチ結果を参照できるようになった。 続きを読む 概要 プロミスの成功・失敗に関わらず継続して処理を行うためのPromise.prototype.finallyメソッドが実装された 続きを読む 概要 配列のSpread/Rest構文のように、オブジェクト内に別のオブジェクトを展開する構文が実装された。 続きを読む 概要 関数を定義する際、パラメータの末尾にカンマを付けてもよいことになった。 続きを読む 概要 対象のオブジェクトがもつ全てのPropertyDescriptorsを得られる関数が実装された。 続きを読
Update 2013-11-28: There won’t be generator arrow functions in ECMAScript 6 (details). In ECMAScript 5, one creates all callable entities via functions. ECMAScript 6 has more constructs for doing so. This blog post describes them. The status quo: ECMAScript 5 In ECMAScript 5, functions do triple duty: As normal functions: you can directly call functions. As methods: you can assign a function to th
ECMAScript, the official name for the language we all know as JavaScript, has enjoyed tremendous success over the last couple of years. With convergent standard support, performance boosts from modern JavaScript engines, as well as its foray into the server-side stack, ECMAScript has gained significant traction and redefined the scope of HTML5 applications. The final requirement for world dominati
Build the skills your teams need Give your teams the O’Reilly learning platform and equip them with the resources that drive business outcomes. Click on a feature below to explore. Trusted content Live online events Courses Interactive learning Certification prep O’Reilly Answers AI Academy Assignments Insights Dashboard Trusted content you can count on More than 60K titles from O’Reilly and nearl
Update 2014-09-07: Newer version of this blog post: “ECMAScript 6 modules: the final syntax”. Read it instead of this one. This blog post first explains how modules work in ECMAScript 6, the next version of JavaScript. It then describes tools that allow you to already use them now. Module systems for current JavaScript JavaScript does not have built-in support for modules, but the community has cr
578700 – (harmony:bindata) [meta] Harmony binary data objects harmony:binary_data [ES Wiki] numerictypes.js arraytype.js structtype.js 894026 – Implement BinaryIntegerLiteral and OctalIntegerLiteral binary-literals.js octal-literal.js Binary Data Object 新たに数値型として、 uint8 uint16 uint32 uint64 int8 int16 int32 int64 float32 float64 の関数。 そして、上記の型関数などを引数にしてバイナリーデータ的なArrayやStructorを定義できるコンストラクタとして Array
Update 2012-02-01: Complete rewrite of the section on spreading constructor arguments. Sometimes, one needs to spread the elements of an array, to use them as the arguments of a function call. JavaScript allows you to do that via Function.prototype.apply, but that does not work for constructor invocations. This post explains spreading and how to make it work in the presence of the new operator. Sp
記事とは関係ない質問なのですが __proto__にnullを設定した場合のみ 以降のinstanceof演算子の挙動が変わるのは仕様なのでしょうか FirefoxとChromeで確認しました o = {} o.__proto__ = Object.prototype o instanceof Object //true o.__proto__ = {} o.__proto__ = Object.prototype o instanceof Object //true o.__proto__ = 'abc' o.__proto__ = Object.prototype o instanceof Object //true o.__proto__ = undefined o.__proto__ = Object.prototype o instanceof Object //true o._
The document discusses the advantages of ES6 (ECMAScript 2015) and the new features it introduces to JavaScript, such as generators, template strings, and lazy sequences. It emphasizes the importance of evolving JavaScript to enhance web development and provides examples of how these features can improve programming practices. Additionally, it touches on contextual auto-escaping and localization,
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く