身近なところで話題になったので。 過去にも、「empty() とか remove() するより、DOMオブジェクトにアクセスして innerHTML = ”” した方が速いよ!」というブログエントリを投下する方が多かったのですが、「必ずAPIを使う」こと。 理由は、「メモリリークの温床だから」 GitHub で manipulation.js のソース読めば判るとおり、結構頻繁に jQuery.cleanData() が実行されてます。― jQuery.cleanData() メソッドは、data() API として独自に実装された「各要素と紐づけられるキー・バリューストア(メモリストア)」に対する処理なので、innerHTML を使う場合でも、jQuery.cleanData() を使うなら、まぁ問題無いです。 要するに、jQuery (Zeptoみたいな類似ライブラリもそう)は、常にH
Chrome拡張作ってて、ある要素のテキストの変更を監視しようとしたときに気づいたのでメモ。 書いてあること以上のことは調べていない。*1 要素内のテキストをjQuery.text()で変更している場合と、innerHTMLで変更している場合とで発生するDOMNodeInsertedとDOMSubtreeModifiedに差異があってなんだかなーなんだかなーという話。 とあるh1要素の変更を監視するため、以下のように DOMNodeInsertedとDOMSubtreeModified を設定。 document.querySelector('div.foo h1').addEventListener('DOMNodeInserted', function(e){ console.log('***DOMNodeInserted:' + e.srcElement.constructor.na
$(document).ready(fn) - bindReady() - $.ready() $(document).ready(fn) が bindReady() を、そしてそこから $.ready() が呼び出される三層構造で、これらのメソッドが機能します。 それぞれの役割は、順に以下のようになります。 $(document).ready(fn)……(1/2) DOM読み込み完了通知イベントの登録( bindReady()メソッドの実行 ) $(document).ready(fn)……(2/2) DOM 読み込み完了時の fn の実行と DOM 読み込み完了時に実行させる関数の登録、 bindReady()……(2) DOM 読み込み完了のチェックと完了時の jQuery.ready()呼び出し jQuery.ready()……(3) DOM 読み込み完了を記録するプロパティの設定
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く