グローバル領域に以下の一行を書く <script> var currentScript = (function (e) { if(e.nodeName.toLowerCase() == 'script') return e; return arguments.callee(e.lastChild) })(document); alert(currentScript); </script>こうすることで、currentScript はこの script 要素を指す。 いちおう説明 DOM は構築されるときに、上から順番に構築される。そして、script タグがあると、 script 要素を構築したあとに、スクリプトを実行する。 つまり、スクリプトが実行されたとき script 要素は今まさに作られたばかりであり、それよりも後ろの要素が存在しない。さらにこの script 要素を含むすべての要
こんにちわ、DeNA San Francisco の渋川と申します。エンジニアブログには初登場です。 JavaScriptのソースコードからAPIドキュメントを生成するツールには何種類かありますが、日本語の書籍やウェブサイトでも情報が得やすいこともあって、JSDocの系統が幅広く使われています。Google Closure Compilerも、JSDocを拡張したドックコメントをアノテーションとして読み込んで最適化します。 JSDocは長い期間メンテナンスされているオープンソースプロダクトです。初代はPerlで書かれたJSDoc 1です。これはすでにリポジトリも削除されています。現在最も使われているのが JSDoc Toolkit (JSDoc 2) です。弊社の ngCoreのドキュメント でも使用しています。 ただ、これも現在は機能追加を停止していて、後継プロダクトの JSDoc 3
Backbone Patterns Building apps with Backbone.js Here, I try to document the good practices that our team has learned along the way building Backbone applications. This document assumes that you already have some knowledge of Backbone.js, jQuery, and of course, JavaScript itself. Table of contents Model patterns Bootstrapping data View patterns Inline templates JST templates Partials Animation buf
When I was working on a script to preload images with JavaScript one of the decisions I had to make was whether to use document.createElement('img') or an image object to preload the image into. The recommended w3c method is to use document.createElement('img') as it is a consistent way to create elements. This is the method I used. But, I was wondering which performed better. So, I ran some tests
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く