Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
追記:Twitter / 10th543: あ・・・ボタンが��で指摘されたのでmetaタグを追加した。どちらにしろ、script要素のdefer属性を使っているので、Firefox3.1以降じゃないと動かないと思う。 FIrefoxだと、Function#toSourceに数値を渡せばきれいにインデントしてくれる。 それを使ってコードを整形する物をinstant JavaScript code formatterに書いた。 例えば、 var t = (new Date).getTime();var i;for(i=0;i<10000;++i){(function () {return 3;}())};;; (window.console && console||alert)(new Date().getTime() - t); alert("ok!"); alert(t += 2); s
id:cho45 がチョロっと書いたコードが話題になっている 冬通りに消え行く制服ガールは✖夢物語にリアルを求めない。 - subtech このような書き方は、自分もたまにする。 というわけで、この書き方をする利点を以下の順に解説して見る。 単純な for 文の問題点 with 文を使った解決方法と、その微妙な問題点 無名関数を使った解決方法 単純な for 文の問題点 まずは、以下の HTML に対して <ul> <li>hoge</li> <li>fuga</li> <li>piyo</li> </ul> 以下の JavaScript を実行して var list = document.querySelectorAll('ul > li'); for (var i = 0, len = list.length; i < len; i++) { var node = list[i]; v
前回はスコープチェインのお話に入るための予備知識として「変数オブジェクト」についてのお話をしました。それを踏まえて、今回はスコープチェインと、それによって実現されているクロージャについてしっかり学んでいきたいと思います。 スコープチェインとは 変数オブジェクトに関する説明はしっかりご理解頂けましたでしょうか?JavaScriptの変数は、全て変数オブジェクトのプロパティとして扱われている事、そして変数オブジェクトは状況に応じて違うものが使われる(グローバルスコープであればグローバルオブジェクト、ローカルスコープであれば目に見えない変数オブジェクト)というものでした。ローカルスコープに対応する変数オブジェクトは「アクティベーションオブジェクト」と呼ばれ、関数呼び出しが行われると自動的に作成されます。 しかし実際は、変数を参照するという事は、その場における変数オブジェクト「だけ」を探す訳ではあ
現場主導のデジタル変革 ビジネス変革のための“ITの民主化” そして 変わるIT部門の役割 コーマス広告の大変動 プライバシー保護とパーソナライズの狭間で マーケティングの効果を最大化するためには 注目急上昇中のDaaS最新情報 コロナ禍を背景に利用者と機能を拡大中 Azure Virtual Desktop最新情報 年間5,000件の問い合わせに対応 疑問を解消したいユーザーも答える情シスも みんな幸せになるヘルプデスクの最適解 ID管理の基礎知識 新しい働き方におけるITガバナンスの 向上にむけて Kubernetes活用の最適解とは? 今、注目のコンテナを活用した柔軟なIT基盤 運用、管理の課題を解決しメリットを最大化 勝つためのクラウド活用術 New Value on Azure ビジネスを次のステージへ! 電話営業・インサイドセールの革新 AIによる自動文字起こし・会話分析が 音
It is with much happiness that I think I can finally say, without seeming like a fool, that: “JavaScript Getters and Setters are now prevalent enough to become of actual interest to JavaScript developers.” Wow, I’ve been waiting a long time to be able to say that. I want to start by giving a whirlwind tour of Getters and Setters and why they’re useful. Followed by a look into what platforms now su
Private Members in JavaScript Douglas Crockford www.crockford.com JavaScript is the world's most misunderstood programming language. Some believe that it lacks the property of information hiding because objects cannot have private instance variables and methods. But this is a misunderstanding. JavaScript objects can have private members. Here's how. Objects JavaScript is fundamentally about object
Yahoo UI を使うと JavaScript のユニットテストが非常に簡単にできます。 サンプルは、以下のページを参考にして書いたものです。※1 Getting Started with JavaScript Unit Testing and YUI Test 用意するものは以下の3つ テスト対象の JS ファイル テストを書いた JS ファイル テストを実行する HTML ファイル ここでは上から、簡単な足し算をする add.js、add-test.js、unittest.html を用意しました。 add.js /** * 簡単な足し算関数。arg1 と arg2 の合計を返す。 * 引数が未指定又は、非数値の場合、結果は NaN になる。 */ function add(arg1, arg2) { arg1 = arg1 ? arg1 : NaN; arg2 = arg2 ? a
Firefox3でしか使えませんが、 Firefox拡張機能開発で、 QueryInterface NSGetModule メソッドを書くとき、やたら長いコードを毎回書かなくてはならず、めんどくさくてしょうがない方のためのモジュールです。 https://developer.mozilla.org/Ja/XPCOMUtils.jsm http://mxr.mozilla.org/mozilla/source/js/src/xpconnect/loader/XPCOMUtils.jsm ソースコードに使い方が書いてありますが、改めて説明。 XPCOMUtilsを読み込む Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); QueryInterface の書き方 XPCOMUtils.generateQI([Com
織田信長 ぼちぼち、元気にやっています。少し薬にも慣れた...んかなぁ。相変わらず食べられないけど。朝、指がこわばって文字なんて入力できなかったけど、それはほぼなくなった。関節もどこも痛くない。薬効いてきたんやろな。 で、ブログを書こうと言う気がまた起きてきた。 …
この文書では、Mozilla の chrome コード (XUL アプリケーションや 拡張機能) の中で複数のウィンドウを取り扱う方法を解説します。また、新規ウィンドウを開く、すでにウィンドウが開いているか確認する、異なるウィンドウ間でデータを受け渡すといった場面での tips やサンプルコードを紹介します。 新規ウィンドウを開くためには、通常は window.open もしくは window.openDialog の DOM メソッドを次のように呼び出します。 var win = window.open("chrome://myextension/content/about.xul", "aboutMyExtension", "chrome,centerscreen"); window.open の 1 つめのパラメータはウィンドウとその内容を記述した XUL ファイルの URI です。
Latest topics > Split Browser開発のよもやま話(1):コンセプト確定まで 宣伝。日経LinuxにてLinuxの基礎?を紹介する漫画「シス管系女子」を連載させていただいています。 以下の特設サイトにて、単行本まんがでわかるLinux シス管系女子の試し読みが可能! « ブラウザを分割する「Split Browser」リリースしてみた Main Split Browser開発のよもやま話(2):小型ブラウザの制作 » Split Browser開発のよもやま話(1):コンセプト確定まで - Jan 13, 2007 Split Browserを作るに至った経緯とかその辺の話。拡張機能勉強会なんてのも開催されるので、まあ、もしかしたら誰かの何かの役に立つかもなあ、と。のべ時間にして24時間くらいでできたんで、割と細かいところまで覚えてるからというのも理由の一つではある
DOM APIを使用して作ったDOMツリー、うまく生成されているか見てみたい事は多々ある。少なくともオイラはある。簡単にテキスト表示してくれると嬉しいなぁと常々思っていたのだが発見した。 Firefox(というかMozilla系かな)限定だろうけどXMLSerializerがあるのだ。 使い方は簡単。 var serializer = new XMLSerializer(); //略 var root = document.createElement('div'); var anchor = document.createElement('a'); var aText = document.createTextNode('はてな'); anchor.setAttribute('href','http://www.hatena.ne.jp/'); anchor.appendChild( aT
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く