&pgid;
- 最近
&ref(http://g-ec2.images-amazon.com/images/I/41tEcLQDdOL._AA240_.jpg);
Ajaxデザインパターン ―ユーザビリティと開発効率の向上のために (大型本)
http://www.amazon.co.jp/dp/4873113237
という本を読んでいます。
-その本の中に「Unobtrusive JavaScript」という言葉が出てきたので調べてみました。
- HTML内にJavaScriptをできるだけ書かないようにしようというコーディングスタイルを「Unobtrusive JavaScript」と呼ぶらしいです。
** Unobtrusive JavaScript - Wikipedia [#nd28aa34]
-
Unobtrusive JavaScript - Wikipedia
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
の超訳。
-
Unobtrusive JavaScript can be seen as part of the larger Web standards movement;
「Unobtrusive JavaScript」は、大きなWeb標準の動きの一部としてみることができる。
-
much as the demand for cross-browser compatibility has driven the increasing emphasis
on standardized markup and style,
クロスブラウザに対するより多くの要求が、標準のマークアップとスタイルの標準化の強調の増加を推進している
-
the increasing demand for rich Internet applications is driving the movement toward the more
robust methods of unobtrusive JavaScript.
RIAの要求の増加は、Unobtrusive JavaScriptのより頑強な方法の方向への移動を推進している
-
<input type="text" name="date" onchange="validateDate(this);" />
こんな風に、<input>タグのonchangeに書くのではなく、CSSでclassを割り振って、そこにイベントを動的に当て込め、と。
<input type="text" name="date" class="datefield" />
// Register onchange event handlers for all datefield elements
// This script uses objects and methods specific to the Prototype library
datefields = document.getElementsByClassName("datefield");
datefields.each(function(e){
Event.observe( e, "change", validateDate );
});
** たしかに! [#k1bb4933]
- そういう必要性はすごく感じますし、いたるところでも言われていますよね。
-ついこないだまで読んでいた
&ref(http://g-ec2.images-amazon.com/images/I/51XH9AM41XL._AA240_.jpg);
Ajaxインアクション
http://www.amazon.co.jp/dp/4844322222
では、HTML内にjavascriptを書くのは、初期のPHPプログラミングで、HTMLとPHPを混在させて書いていたのと似ている、というようなことが書いてました。
- やっぱり、こういった組み方を積極的にやって言った方がいいですよね。&bigsmile;
- 同様に、Unobtrusive CSSという言葉もあると、この本に書いてありました。
#blikifooter(志田)
tag: [[JavaScript>tag/JavaScript]]